如何在WPF中设置复选框的背景色

如何在WPF中设置复选框的背景色,wpf,Wpf,在WinForm中,我们可以设置复选框的背景色 我如何在WPF中执行此操作?我试着 <CheckBox Content="CheckBox" Background="Red"/> 但这只会更改矩形边框的颜色 我也尝试 <CheckBox> <TextBlock Text="CheckBox" Background="Red"/> </CheckBox> 但这只会更改文本背景色,不包括矩形 ======= 谢谢大家提供的解决

在WinForm中,我们可以设置复选框的背景色

我如何在WPF中执行此操作?我试着

<CheckBox Content="CheckBox" Background="Red"/>

但这只会更改矩形边框的颜色

我也尝试

<CheckBox>
    <TextBlock Text="CheckBox" Background="Red"/>
</CheckBox>

但这只会更改文本背景色,不包括矩形

=======


谢谢大家提供的解决方案。我认为最简单的方法对我来说是可行的:)

如果你对面板做一点实验,你就会达到目的:

<Grid Background="Red" HorizontalAlignment="Left">
  <CheckBox Content="test" />
</Grid>

非常接近你想要的。
我自己试过;-)

你要求的太少了。使用Blend,我为
复选框创建了一个相关的样式

代码太大了。所以不允许展示。这是馅饼

对于
背景
有一个网格
markGrid
。我添加了
背景
模板绑定
,以强制
复选框
更改颜色。缺点是,如果背景较暗,路径颜色将非常模糊

<Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <CheckBox FlowDirection="RightToLeft" background="Red"
                          IsChecked="False" />
                <Border Grid.Column="1"
                        Margin="20 0 0 0"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        Background="LightGray">
                    <TextBlock HorizontalAlignment="Left"
                               Foreground="Black"
                               Style="{StaticResource RegularTextblock}"
                               Text="Checkbox1" />
                </Border>
            </Grid>