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