我正在尝试更改每个状态的按钮外观,现在我有IsEnabled
IsPressed
IsMouseOver
,但鼠标左键发布的Tigger Property
是什么?
<Style x:Key="GoogleGreyButton" TargetType="{x:Type Button}">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!--Some setters here-->
</Trigger>
<Trigger Property="IsPressed" Value="True">
<!--Some setters here-->
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<!--Some setters here-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
答案 0 :(得分:0)
您需要更多的风格才能展示任何内容,但请尝试以下活动:
<Style x:Key="GoogleGreyButton" TargetType="{x:Type Button}">
<EventSetter Event="MouseLeftButtonUp" Handler="Button_MouseLeftButtonUp"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<!--Some setters here-->
</Trigger>
<Trigger Property="IsPressed" Value="True">
<!--Some setters here-->
</Trigger>
<Trigger Property="IsEnabled" Value="True">
<!--Some setters here-->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
答案 1 :(得分:0)
您可以使用EventTrigger:
<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
<BeginStoryboard>
<Storyboard>
...
</Storyboard>
</BeginStoryboard>
</EventTrigger>