dimanche 17 novembre 2019

Costum CheckBox style changes

So i have this CheckBox:

<CheckBox Name="CheckBoxEnableLoops"
          Style="{StaticResource MaterialDesignActionAccentCheckBox}"/>

Style

<Style x:Key="MaterialDesignActionAccentCheckBox" TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignActionCheckBox}">
    <Style.Triggers>
        <Trigger Property="IsChecked" Value="True">
            <Setter Property="Background" Value="Teal"/>
            <Setter Property="Foreground" Value="Gainsboro"/>
        </Trigger>
        <Trigger Property="IsChecked" Value="False">
            <Setter Property="Background" Value="Red"/>
            <Setter Property="Content" Value="x"/>
        </Trigger>
    </Style.Triggers>
</Style>

And when this CheckBox checked i can see v sign and when checked=false nothing so i add this x sign to my style but i cannot changed its color and its always dark although this line:

<Setter Property="Background" Value="Red"/>

I also did not understand where this V sign (when checked=true) come from and why the CheckBox checked=false i cannot see any sign.




Aucun commentaire:

Enregistrer un commentaire