For example, in one window there are 3-4 usercontrol , each has its own ViewModel . They have events that some data has changed. How to subscribe to these events from the point of view of MVVM? Or just give each control a name and subscribe to CodeBehind ?

  • one
    Give an example of the source code, which events exactly do you mean? When using MVVM, you should not write something in CodeBehind. - klutch1991

2 answers 2

As usual: you bind data in your UserControl 'ax through Binding to your VM. This is the only correct way, there is no other way.

Data change events are the wrong way, controls should set dependency property, not event'y. (Event'y expose can, but only in addition.)

    You can do so. The object implements the INotifyPropertyChanged interface; in this case, the View will be automatically informed about the data changes in the object through binding data binding.