ICOmmand - canexecute can not disable Button with image content.
Posted
by
Anish
on Stack Overflow
See other posts from Stack Overflow
or by Anish
Published on 2010-12-26T06:10:30Z
Indexed on
2010/12/26
19:54 UTC
Read the original article
Hit count: 249
Hi ,
I have a button control in my wpf-mvvm application.
I use an ICommand property (defined in viewmodel) to bind the button click event to viewmodel.
I have -> execute and canexecute parameters for my ICommand implementation (RelayCommand).
Even if CanExecute is false...button is not disabled...WHEN button CONTENT is IMAGE
But, when button content is text..enable/disable works fine.
<Button DockPanel.Dock="Top"
Command="{Binding Path=MoveUpCommand}">
<Button.Content>
<Image Source="/Resources/MoveUpArrow.png"></Image>
</Button.Content>
<Style>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value=".5" />
</Trigger>
</Style.Triggers>
</Style>
</Button>
© Stack Overflow or respective owner