Update All UI Property Bindings At Once

Mar 14, 2012 at 3:26 AM


Is there a way to call "NotifyPropertyChanged" to cause all the UI Properties to update their bindings at once? I came across this blog: http://jobijoy.blogspot.com.au/2009/07/easy-way-to-update-all-ui-property.html

I'm wondering if we can achieve the same thing in the Simple MVVM toolkit framework. Thanks.



Mar 14, 2012 at 4:06 PM
There's nothing to stop you from inserting a method in your ViewModel and firing the PropertyChanged event from there. This would accommodate the scenario where you have something like a timer and want to have changed property values reflected in the UI at one moment in time.

In most scenarios, however, I'm not convinced this buys you much of anything. Most of the time, you want to have the binding update the UI when a property value changes.

Mar 15, 2012 at 12:55 AM

Hi Tony,

Thanks for your response. I'm not able to come out with the correct expression to be passed into the "NotifyPropertyChanged" method in my ViewModel, so that it will eventually use String.Empty as the property name in the PropertyChangedEventArgs. Hope you can help me with that.

I tried manually firing the "PropertyChanged" event in my ViewModel and obviously it didn't allow me to do so.





Mar 15, 2012 at 1:24 AM
From a ViewModel you can fire the propertyChanged event (not PropertChanged) - notice the lower case "p" - this is a protected member, so it is accessible from derived classes. ;-)
Mar 16, 2012 at 6:29 AM

Thanks Tony! It all works now :-)