mardi 13 décembre 2016

Checkbox IsMouseOver wont work

When i add this controltemplate my checkboxes disapear and only the checkbox text is shown. And when mouse is over the textbackground becomes red, how do i get my checkbox background red when mouse is over?

<Style TargetType="CheckBox" x:Key="Checkbox">
            <Setter Property="BorderThickness"          Value="2" />
            <Setter Property="VerticalAlignment"        Value="Top" />
            <Setter Property="Margin"                   Value="20,15,0,0" />
            <Setter Property="FontFamily"               Value="/Resources/Fonts/Source Sans Pro/#Source Sans Pro" />
            <Setter Property="FontSize"                 Value="14" />
            <Setter Property="HorizontalAlignment"      Value="Left" />
            <Setter Property="Foreground"               Value="{DynamicResource CheckboxForegroundColor}" />
            <Setter Property="Background"               Value="{DynamicResource CheckboxBackgroundColor}" />
            <Setter Property="BorderBrush"              Value="{DynamicResource CheckboxBorderbrushColor}"/>


            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type CheckBox}">
                        <CheckBox  Background="{TemplateBinding Background}" >
                            <ContentPresenter  />
                        </CheckBox>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Background" Value="Red"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>




Aucun commentaire:

Enregistrer un commentaire