RaisePropertyChanged for Windows Phone

Posted by chief7 on Stack Overflow See other posts from Stack Overflow or by chief7
Published on 2010-06-13T12:37:55Z Indexed on 2010/06/13 12:42 UTC
Read the original article Hit count: 392

Filed under:
|
|

I'm starting to use the MVVMLight framework and have a question about binding to properties in the ViewModel. I found that I have to call the RaisePropertyChanged method in the setter for the property in order for the View to be updated. And I have to call RaisePropertyChanged from through the dispatcher otherwise I get a thread access error.

    public string Lat { get { return _lat; } set
    {
        _lat = value;
        Deployment.Current.Dispatcher.BeginInvoke(() => RaisePropertyChanged("Lat"));
    } }

This works but its a lot of code to get auto binding properties. Is there a helper to handle this more cleanly?

© Stack Overflow or respective owner

Related posts about windows-phone-7

Related posts about mvvm-light