due to the mvvm pattern Model shouldn’t know anything about ViewModel.
What if I create a ListBox Field in one of my Model. Looks well and right.
But next step I have to tie this value to the ObservableCollection in ModelView.
I can do this:
var myCollection = new ObservableCollection (myList);
But in this case I lost of all advantages for OC. THis collection made static and neither inserts or updates reflects in my View tied to this collection.
Any thoughts ?
When you call
You are copying the values of myList into the ObservableCollection. Nothing here will update ListBox list.
If this is the desired effect, and you may want to update your ViewModel with:
This way, every time the ObservableCollection updates, you synchronize the underlying model with the changes.