After a major edit to this quesiton, I'm hoping it's now clear.
I'm very lost with binding in WPF when 1 change should affect multiple properties.
I regularly use VVM to bind my ViewModel to my View and I would say I'm OK with it.
I am trying to implement a state controller. This means that, what ever settings I made in part of my UI, the reflection is through out.
For example in my part of my UI, I can toggle a feature on or off, such as "show images"
When I make this change, I'd like everything in my application to be notified and act accordingly.
So, my StateController class will have a property
public bool ShowImages And in my View, I'd likely have something like
<image Visible ="{Binding ShowImages", Converter={StaticConverter ConvertMe}}" /> The problem I have is how I go about making the StateController alert all of my ViewModels of this.
Currently, in each ViewModel I'm assuming I'd have to have the same property repeated
public bool ShowImages EG
public class StateController : BaseViewModel { public bool ShowImages{get;set;}//imagine the implementation is here } public class ViewModelB : BaseViewModel { public bool ShowImages{}//imagine the implementation is here } public class ViewModelB : BaseViewModel { public bool ShowImages{}//imagine the implementation is here } So, my question is, if I updated ViewModelB.ShowImages, how would I first inform the StateController which in turn updates all ViewModels.
Is this something the INotifyPropertyChanged can do automatically for me since they all share the same propertyName, or do I have to implement the logic manually, eg
public static class StateController { public bool ShowImages{get;set;}//imagine the implementation is here } public class ViewModelA : BaseViewModel { public bool ShowImages { get { return StateController.ShowImages; } set { StateControllerShowImages = value; OnPropertyChanged("ShowImages"); } } } public class ViewModelB : BaseViewModel { public bool ShowImages { get { return StateController.ShowImages; } set { StateControllerShowImages = value; OnPropertyChanged("ShowImages"); } } } I hate the idea of the above implementation but it does show what I'm trying to achieve. I just hope there is a better way!