无法更改xceed checklistbox中的复选框颜色

时间:2018-04-09 09:53:08

标签: wpf controls themes xceed checklistbox

我们如何在Xceed的CheckListbox控件中更改复选框的刻度颜色。 我已经尝试过这段代码

<Style.Triggers>
                    <Trigger Property="IsSelected" Value="False">
                        <Setter Property="Background" Value="Transparent"></Setter>
                    </Trigger>
                    <Trigger Property="IsMouseOver" Value="False">
                        <Setter Property="Background" Value="Transparent"></Setter>
                    </Trigger>
                    <Trigger Property="IsKeyboardFocusWithin" Value="False">
                        <Setter Property="Background" Value="Transparent"></Setter>
                    </Trigger>

                </Style.Triggers> 

1 个答案:

答案 0 :(得分:0)

CheckListBoxCheckBox元素的集合,您可以照常设置样式。这应该有效:

<xctk:CheckListBox x:Name="_listBox" ...>
    <xctk:CheckListBox.Resources>
        <Style TargetType="CheckBox">
            <Style.Triggers>
                <Trigger Property="IsChecked" Value="True">
                    <Setter Property="Background" Value="Red"></Setter>
                </Trigger>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="Green"></Setter>
                </Trigger>
                <Trigger Property="IsKeyboardFocusWithin" Value="True">
                    <Setter Property="Background" Value="Blue"></Setter>
                </Trigger>
            </Style.Triggers>
            <Setter Property="Background" Value="Yellow" />
        </Style>
    </xctk:CheckListBox.Resources>
</xctk:CheckListBox>