I'm trying to implement a toggle button that permits the user to select between linear or logarithmic axis.
For that I have in my View this ToggleButton:
<ToggleButton Width="40" Height="20" Margin="2" Grid.Row="1" Content="LogX" VerticalAlignment="Center" IsChecked="{Binding LogXChecked, Mode=TwoWay}"/>
In my ViewModel:
private bool _isLogXChecked;
public bool IsLogXChecked
{
get
{
return _isLogXChecked;
}
set
{
_isLogXChecked = value;
RaisePropertyChanged("IsLogXChecked");
LogX();
}
}
But with this implementation I can't get it to work, the IsLogXChecked property does not update when the user presses the ToggleButton, and my method LogX() does not fire.
Where might be the problem? Or how should I bind a ToggleButton to a bool? Thank you.