Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Wpf样式的ispressed属性不会持续_C#_Wpf - Fatal编程技术网

C# Wpf样式的ispressed属性不会持续

C# Wpf样式的ispressed属性不会持续,c#,wpf,C#,Wpf,我已经设计了我的按钮时,按钮被点击,它会给一个3刷厚度。是的,当我按下它时,它会改变,但为什么我不能持续 我的意思是我想让它保持它的压制风格 <Style TargetType="{x:Type Button}" x:Key="BorderButton"> <Setter Property="Template"> <Setter.Value> <ControlTemplate Ta

我已经设计了我的按钮时,按钮被点击,它会给一个3刷厚度。是的,当我按下它时,它会改变,但为什么我不能持续

我的意思是我想让它保持它的压制风格

 <Style TargetType="{x:Type Button}" x:Key="BorderButton">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Border Background="{TemplateBinding Background}" x:Name="ButtonBorder" >
                        </Border>

                        <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="ButtonBorder" Property="BorderBrush" Value="White"/>
                            <Setter TargetName="ButtonBorder" Property="BorderThickness" Value="3"/>
                        </Trigger>


                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

我的代码怎么了


谢谢

您要查找的行为是典型的按钮或复选框,而不是按钮。只有在按住鼠标按钮时,按钮才会被按下。当您单击复选框或切换按钮时,它会在两种状态之间切换(isChecked为true或false)