lundi 22 février 2016

XAML Checkbox Background and BorderBrush colors don't change on MouseOver

How can i change CheckBox BorderBrush and Background Colors on MouseOver? I tried this way but it doesn't work:

<CheckBox Style="{DynamicResource checkBox}">CheckBoxText</CheckBox>

And here is my style:

<Style TargetType="{x:Type CheckBox}" x:Key="checkBox">

    <!-- This part changes the colors -->
    <Setter Property="BorderBrush" Value="LightGray" />
    <Setter Property="BorderThickness" Value="3" />
    <Setter Property="Background" Value="LightGray" />

    <Style.Triggers>

        <Trigger Property="IsMouseOver" Value="True">

            <!-- This part is not changing the colors -->
            <Setter Property="BorderThickness" Value="3" />
            <Setter Property="Background" Value="Gray" />
            <Setter Property="BorderBrush" Value="Gray" />

        </Trigger>

    </Style.Triggers>

</Style>

Changing these colors works for <Trigger Property="IsChecked" Value="True"> condition. But it's not working for IsMouseOver.




Aucun commentaire:

Enregistrer un commentaire