【发布时间】:2017-09-19 01:01:52
【问题描述】:
我使用 BorderThickness=2 制作了一个自定义复选框按钮。 我想在选中时将边框的颜色更改为蓝色。
问题是边框和图标之间有一条很细的黑线,这让我很恼火。有什么办法可以去掉这个吗?
下面是我的按钮样式字典的部分代码。
<Style x:Key="ExampleButton" TargetType="{x:Type CheckBox}">
<Setter Property="Width" Value="40" />
<Setter Property="Height" Value="40" />
<Setter Property="Background" Value="{StaticResource BrushDarkGray11}" />
<Setter Property="BorderBrush" Value="{StaticResource BrushDarkGray11}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<Border x:Name="Grid" Background="{TemplateBinding Background}"
CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="2">
<ContentPresenter x:Name="Content" Content="{TemplateBinding Content}"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Grid" Property="BorderBrush" Value="{StaticResource BrushBlue1}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
【问题讨论】: