I have a button that will be enabled or disabled with the use of a bool, I am using MVVM:
Button:
<Button x:Name="backButton" Content="Back" Command="{Binding BackCommand}"
IsEnabled="{Binding Path=BackBool, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
The bool:
public bool BackBool
{
get { return isBackEnabled; }
set
{
this.RaisePropertyChangedEvent("isBackEnabled");
isBackEnabled = value;
this.RaisePropertyChangedEvent("isBackEnabled");
}
}
I've added the bool to the variable watch and it updates correctly changing to true when the buttons should be enabled.
However the Buttons them selves do not update and always stay disabled.
Am I missing something?
Modified version of your code
Button:
<Button x:Name="backButton" Content="Back" Command="{Binding BackCommand}"
IsEnabled="{Binding Path=BackBool, Mode=OneWay}"/>
The bool:
public bool BackBool
{
get { return isBackEnabled; }
set
{
isBackEnabled = value;
this.RaisePropertyChangedEvent("BackBool");
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments