Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What can i do with RaisePropertyChanged?

I'm using MVVM Light in a Windows Phone Silverlight application.

I don't really get how RaisePropertyChanged should works; Let me explain, in code like this

private Recipe _selectedRecipe;

public Recipe SelectedRecipe
{
    get
    {
        return this._selectedRecipe;
    }
    set
    {
        this._selectedRecipe = value;
        RaisePropertyChanged("SelectedRecipe");
    }
}

What should happen when RaisePropertyChanged("SelectedRecipe") is called?

I expect the call to a new method with my code to execute, or something like that, but i can't be able to find something similar in (the few) examples i found. So, how it works?

like image 538
maxdelia Avatar asked Oct 08 '22 13:10

maxdelia


1 Answers

The InotifyPropertyChanged event is important for data binding in Silverlight, and the RaisePropertyChanged method provided as part of the MVVM-Light toolkit is a helper to raise the event if anyone is listening out for it.

like image 106
Rowland Shaw Avatar answered Oct 12 '22 10:10

Rowland Shaw