Roberto Salemi

Roberto Salemi

  • NA
  • 146
  • 141.5k

[WPF] Button maintain hover state after click

Mar 4 2015 10:34 AM
I defined my custom button:


<Button Name="editSchedule" Width="60" Height="60"
ToolTip="{StaticResource commandEdit}" ToolTipService.ShowOnDisabled="True"
Click="editSchedule_Click">
<Button.Content>
<Border CornerRadius="2" Margin="0" Padding="5" BorderThickness="2,2,2,2"
BorderBrush="{StaticResource iconMenuColor}"  Background="{StaticResource iconMenuBackgroundColor}">
<Path
Width="24" Height="24"
Canvas.Left="15.8333"
Fill="{StaticResource iconMenuColor}"
Canvas.Top="20.5833"
Stretch="Fill"
Data="{StaticResource ToolBarIconModify}"
/>
</Border>
</Button.Content>
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource ActionEnabledConverter}" >
<MultiBinding.Bindings>
<Binding Source="{StaticResource UserInfoViewModel}" Path="Actions"/>
<Binding Source="{StaticResource ModifySchedule}"/>
<Binding Path="IsEnabled"></Binding>
</MultiBinding.Bindings>
</MultiBinding>
</Button.IsEnabled>
</Button>  


It's perfect, I would add a new condition: maintain the hover state when click and remove hover state when I click on another button, called saveSchedule.


How can I resolve it?


Answers (2)