This project has moved. For the latest updates, please go here.

ViewModelBase.Set() vs ObservableObject.Set()

Jun 7, 2012 at 1:45 AM

Hi, I've just started using MVVM Light with a Windows 8 Metro App, and I'm trying to understand a couple of things about how ViewModelBase / ObservableObject Set() methods work.

ObservableObject.Set() returns true if the property was changed. Is there a reason why ViewModelBase.Set() does not behave in the same fashion?

Is there a reason why the ViewModelBase.Set() implementation does not call through to the ObservableObject.Set() methods?

Is there a reason why ViewModelBase.Set() implementations do not raise property changing events?

Jun 10, 2012 at 7:45 PM


Very interesting questions, I had to check it out myself.

1) Why does ObservableObject.Set return true and not ViewModelBase.Set? This is an oversight and will be fixed in V4 RTM.

2) Is there a reason why ViewModelBase.Set does not call through OO.Set? Mostly this is because of the Broadcast feature that is only in the VMBase class. This feature allows you to specify that in addition to setting the value, you also want to send a PropertyChangedMessage using the VMBase's MessengerInstance.

3) ViewModelBase.Set not raising PropertyChanging event was an oversight too. Not sure what i was thinking :)

Cheers and thanks a lot for the feedback.