Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Auto Property to Notification Property (MVVM in WPF)

Is there any way to convert Auto property to Notify Property automaticly?

INotifyPropertyChanged

Or any other way for MVVM in WPF

public string Filename { get; set; }

To

string _Filename;
public string Filename {
    get { return _Filename; }
    set {
        if (PropertyChanged != null) {
            _Filename = value; 
            PropertyChanged(this, new PropertyChangedEventArgs("Filename"));
        }
    }
}
like image 385
Omid Mafakher Avatar asked Dec 04 '12 05:12

Omid Mafakher


1 Answers

There's a kindofmagic project that looks close to what you need.

It's an MSBuild task that processes your assemblies and adds PropertyChanged calls to the properties decorated with some [Magic] attribute. I've used it a bit and find extremely helpful.

like image 138
Shaddix Avatar answered Sep 27 '22 22:09

Shaddix