0

我正在尝试更改按钮查看每个状态,现在我有了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>
4

2 回答 2

0

您可以为此使用EventTrigger

<EventTrigger RoutedEvent="PreviewMouseLeftButtonUp">
    <BeginStoryboard>
        <Storyboard>
            ...
        </Storyboard>
    </BeginStoryboard>
</EventTrigger>
于 2012-09-30T09:50:18.250 回答
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>
于 2012-09-30T09:45:37.903 回答