RelayCommands overriding the "IsEnabled" of my buttons.
Posted
by vidalsasoon
on Stack Overflow
See other posts from Stack Overflow
or by vidalsasoon
Published on 2010-04-28T03:23:34Z
Indexed on
2010/04/30
12:17 UTC
Read the original article
Hit count: 186
mvvm-light
RelayCommands overriding the "IsEnabled" of my buttons.
Is this is a bug? Here is xaml from my View and code from my ViewModel
<Button Grid.Column="0" Content="Clear" IsEnabled="False" cmd:ButtonBaseExtensions.Command="{Binding ClearCommand}" />
public RelayCommand ClearCommand
{
get { return new RelayCommand(() => MessageBox.Show("Clear Command")); }
}
Notice I hardcoded the IsEnabled="False" in my xaml. This value is completely ignored (button always enabled).
I realize that RelayCommand have a CanExecute overload but I did want to use this as I want to do more than just have a disabled button.
© Stack Overflow or respective owner