Better way to trigger OnPropertyChanged

后端 未结 6 1252
悲哀的现实
悲哀的现实 2020-11-29 04:51

We have a WPF Project that follows the MVVM pattern.

In the View Model there is a lot of code that looks like this:

    private string m_Fieldname;
          


        
6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-29 05:12

    Josh Smith has a good article on using DynamicObject to do this here

    Basically it involves inheriting from DynamicObject and then hooking into TrySetMember. CLR 4.0 only, unfortunately, although it may also be possible using ContextBoundObject in earlier versions but that would probably hurt performance, being primarily suited for remoting\WCF.

提交回复
热议问题