我试图在一个复选框中画一个勾号,因为别名似乎不起作用,这些线条实际上是锯齿状的,看起来并不好看。我错过了什么?
<Style x:Key="{x:Type CheckBox}" TargetType="CheckBox">
<Setter Property="Foreground" Value="Black"/>
<Setter Property="RenderOptions.EdgeMode" Value="Aliased"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<BulletDecorator Height="20" MinHeight="20">
<BulletDecorator.Bullet>
<Grid
Width="20"
Height="20">
<Border x:Name="Border"
CornerRadius="0"
Background="Black"
BorderThickness="0"
BorderBrush="Black"
Width="20"
Height="20" >
<Path
x:Name="CheckMark"
Stroke="White"
StrokeThickness="8"
Data="M 3,8 L 5,17,17,2"/>
</Border>
</Grid>
</BulletDecorator.Bullet>
<ContentPresenter Margin="0,0,0,0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
RecognizesAccessKey="True" RenderOptions.EdgeMode="Aliased"/>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="CheckMark" Property="Visibility" Value="Collapsed"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
答案 0 :(得分:0)
通过将渲染选项设置为未指定来管理以解决此问题。