I have a Data Trigger defined this way:
<DataTrigger Binding="{Binding Path=DataContext.MyObject.MyProperty, Mode=OneWay, RelativeSource={RelativeSource AncestorType=UserControl}}" Value="False">
<Setter Property="IsEnabled" Value="False" />
</DataTrigger>
MyObject is in the View Model. Now, when the MyObject's MyProperty changes, it does not Notify the UI, even though the MyProperty does Notify OnPropertyChange. The object MyObject is registered with the Container as we are using Microsoft Prism as the framework.
How should I get this to work?
EDIT: MyObject is defined this way:
public class MyObject : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
private bool _myProperty;
public bool MyProperty
{
get { return _myProperty; }
set
{
if (value == _myProperty)
return;
_myProperty = value;
OnPropertyChanged("MyProperty");
}
}
}