Hey there,
I am using the Model View View-Model pattern for a WPF app. I have a ViewModel (set as a pages DataContext) with two properties, one of which is an Entity with a PropertyChanged event. In the event handler i set the value of the other property (a boolean) to some value.
Now the Button and TextBox properties are binding fine on first load and the PropertyChanged event is firing and doing its thing. However the Button's IsEnable property doesn't update to reflect the change in the property its bound to.
The ViewModel looks sorta like this:
public sealed class CustomerPageViewModel
{
public Customer Customer
{
get;
set;
}
public bool Editing
{
get;
private set;
}
private void Customer_PropertyChanged(object sender,
System.ComponentModel.PropertyChangedEventArgs e)
{
Editing = true;
}
}
And the xaml sorta looks like this:
<TextBox Text="{Binding Customer.Name}" />
<Button Content="Save Changes" IsEnabled="{Binding Editing}" />
How can i get the Button to update its IsEnable property when i change the underlying property in the ViewModel?