This is my button
style:
<Style x:Key="NoBorderButton" TargetType="Button">
<Setter Property="Foreground" Value="White" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="FontSize" Value="15" />
<Style.Triggers>
<Trigger Property="Control.IsMouseOver" Value="true">
<Setter Property="Control.FontSize" Value="18" />
<Setter Property="Foreground" Value="LightSkyBlue" />
</Trigger>
<Trigger Property="Control.IsMouseOver" Value="false" >
<Setter Property="Foreground" Value="White" />
</Trigger>
</Style.Triggers>
</Style>
i want to add another Trigger
to my button
: GotMouseCapture
and LostMouseCapture
but i didn't find it, only via code behind:
private void btnClose_LostMouseCapture(object sender, MouseEventArgs e)
{
btnClose.Foreground = Brushes.White;
}
private void btnClose_GotMouseCapture(object sender, MouseEventArgs e)
{
btnClose.Foreground = Brushes.DarkGray;
}
You can use an
EventTrigger
, here is an example: