Simplest way to achieve automatic notification of property change

后端 未结 6 558
时光说笑
时光说笑 2020-12-04 13:34

I know that there are solutions out there for implementing INotifyPropertyChanged, but none of them are as simple as: reference this library, create/add this attribute, done

6条回答
  •  渐次进展
    2020-12-04 13:56

    There is also UpdateControls.NET. I haven't used it, and it looks like more work than notifypropertyweaver, but it might be good. From the website:

    Data binding without INotifyPropertyChanged

    Update Controls does not require that you implement INotifyPropertyChanged or declare a DependencyProperty. It connects controls directly to CLR properties. It discovers dependencies upon data through layers of intermediate code. This makes it perfect for the Model/View/ViewModel pattern; no extra code is needed in the ViewModel, which sits between the Model and the View.

    Wrap the DataContext of your Window. The wrapper not only implements INotifyPropertyChanged for all of your object's properties, it also automatically detects their dependencies on other properties. There is no base class or interface to implement.

提交回复
热议问题