Is there any event or way to know the trigger when the ViewModel is updating/updated by the View?
INotifyPropertyChanged
and PropertyChanged
is used when the ViewModel updated the View.
But is there any reverse?
Is there any event or way to know the trigger when the ViewModel is updating/updated by the View?
INotifyPropertyChanged
and PropertyChanged
is used when the ViewModel updated the View.
But is there any reverse?
Changes from the view to the view model will trigger
PropertyChanged
as well, as they set properties.If you are using binding then you can use
Binding.SourceUpdated
andBinding.TargetUpdated
Attached Events.If your are binding the controls in your view to the view model, many of the pieces will update the view model as long as you make sure the binding is
Mode=TwoWay
.http://msdn.microsoft.com/en-us/library/system.windows.data.bindingmode.aspx
if for some reason you have set your
UpdateSourceTrigger
in the binding to be Explicit then to update the viewmodel you will need to get the binding expression and call update sourcehttp://msdn.microsoft.com/en-us/library/system.windows.data.bindingoperations.getbindingexpression.aspx