I have a Foo class:
public class Foo
{
public string Value { get; set; }
public string IsDirty { get; private set; }
}
and I have xaml with a TextBox and a Button bound to Foo:
<TextBox Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" ... />
<Button IsEnabled="{Binding IsDirty}" ... />
Once the text in the TextBox is changed (updated on KeyDown), Foo.IsDirty becomes true (until a save button is clicked).
Right now, Button.IsEnabled is not changing when Foo.IsDirty changes.
How might I change the binding on the Button so that it becomes enabled as soon as Foo.IsDirty = true and vice versa?
Thanks!
You need to implement the interface INotifyPropertyChanged in your Foo class: