I have a wpf wpplication with a number of user controls in it. One of these controls has a property called ButtonsEnabled
. This is a bool DependencyProperty in the user control. The property is bound to the IsEnabled property of a couple of buttons on that control.
This user control is used in the MainWindow
. The MainWindow
has a couple of view model objects in it called EocMonitor
and ComMonitor
. These both descend from an abstract base class that implements INotifyPropertyChanged
. The ButtonsEnabled
property on the UserControl is bound to the Status
property using a multibinding and a class that implements IMultiConverter
that I wrote.
The problem is that even though the PropertyChanged event is being raised when the Status
property changes, the IMultiConverter is not being called after it is initially called, so the value of the ButtonsEnabled
property is not changing. As a result, the buttons are not enabling.
What do I need to do to make this work?
I did an end-run around this problem as I am running out of time before we reach our code-freeze for this release. What I did was I added a ButtonsEnabled
DepdendencyProperty
to the MainWindow
class and bound it to the user control's ButtonsEnabled
property. I then added a PropertyChanged
event handler in the MainWindow and and registered it with the DbMonitor
and ComMonitor
objects when they were created. I then wrote code in the PropertyChanged
event handler to set the MainWindow
's ButtonsEnabled
properly.
Everything works and I'll worry about making the other approach work at some later time. Maybe.