Implementing INotifyPropertyChanged - does a better way exist?

前端 未结 30 2634
感情败类
感情败类 2020-11-21 05:23

Microsoft should have implemented something snappy for INotifyPropertyChanged, like in the automatic properties, just specify {get; set; notify;} I

30条回答
  •  独厮守ぢ
    2020-11-21 05:46

    Look here : http://dotnet-forum.de/blogs/thearchitect/archive/2012/11/01/die-optimale-implementierung-des-inotifypropertychanged-interfaces.aspx

    It's written in German, but you can download the ViewModelBase.cs. All the comments in the cs-File are written in English.

    With this ViewModelBase-Class it is possible to implement bindable properties similar to the well known Dependency Properties :

    public string SomeProperty
    {
        get { return GetValue( () => SomeProperty ); }
        set { SetValue( () => SomeProperty, value ); }
    }
    

提交回复
热议问题