I have 2 questions for you today :
1. I have a synchronization problem between the creation of my ViewModel and the binding of my View.
I use the ViewModelLocator to set the DataContext of my ItemsView (UserControl) on my ItemsViewModel. The ItemsView is placed in my MainView wich has its own MainViewModel.
My problem is that my ItemsViewModel is instantiate and initialised when the datacontext of my ItemsView is set. After, this one register its binding on ItemsViewModel Properties and listen OnPropertyChanged on an ObservableCollection
of ItemsViewModel. On any OnPropertyChanged (add or remove element from the ObservableCollection) my ItemsView has to be updated.
But this collection is initialised at the ItemsViewModel initialisation and never updated.
Anybody has a solution to force my view to update/refresh its content ?
2. Is it possible to acces ViewModel properties from the code-behind of my View ? Is it possible to set binding between my View and my ViewModel from the code-behind ?
These questions are very basing and oriented for my project but I think there are based on the MVVM pattern.