I have a big problem with MVVM design. I am trying to catch every PropertyChanged of my inner nested objects, including futhermore propertchanged of their nested objects, in
The best thing to do here is to separate the idea of a Model and a ViewModel.
By having a ViewModel
object that is flatter than the Model
you can avoid this scenario. Using an automatic mapping tool like Automapper then allows you to map the Model
to the ViewModel
and vice versa.
https://github.com/AutoMapper/AutoMapper/wiki/Flattening
class MyDatViewModel : INotifyPropertyChanged
{
public string Str
{
// ... Get Set
}
public int NestedObjNum
{
// ... Get set
}
}
// Configure AutoMapper
Mapper.CreateMap();
// Perform mapping
MyDatViewModel viewModel = Mapper.Map(someData);