H
H
Hirty2016-05-27 22:13:08
WPF
Hirty, 2016-05-27 22:13:08

Trigger doesn't change color on hover?

<Window.Resources>
        <Style TargetType="Button">
            <Setter Property="Foreground" Value="#fff"/>
            <Setter Property="Background" Value="#FF0F4FC5"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="#FF00091B" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>

<Window.Resources>
        <Button Content="Test" Height="100" Margin="18,125,51,138" />

When hovering, it does not change color, as it was standard and remained.
Tell me why you didn't change

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
green-caterpillar, 2016-05-27
@Hirty

Everything looks right. In addition, the style does not have an identifier, and the button does not have a style set. Is it the same in the code or just here in the example?

<Style x:Key="MyStyle" TargetType="Button">
...
<Button Content="Test" Height="100" Margin="18,125,51,138" Style="{StaticResource MyStyle}" />

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question