1

我试图在一个复选框中画一个勾号,由于混叠似乎不起作用,线条确实是锯齿状的,看起来一点也不好看。我错过了什么?

<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>
4

1 回答 1

0

设法通过将渲染选项设置为未指定来解决此问题。

于 2012-11-06T10:25:13.227 回答