I am writing a WPF application and I would like to use an Enum for a State variable.
Example: When the program start up certain controls are disabled until the state changes.
When the state changes I would like to disable/enable a variety of controls via an event handler. I have written plenty of custom event handlers in the past, however, using an enum as the trigger has managed to blow my mind.
Any suggestions?
If you’re using an MVVM approach then I agree with Daniel White that you need to implement INotifyPropertyChanged. You should bind the IsEnabled member on your controls to a property on your ViewModel.
Code:
XAML: