0

This should be pretty simple but I can't work out whats wrong...

I have a button:

 <Button Grid.Column="2"  Style="{StaticResource cust_toolbox}"  Click="fuctionclick" Background="#FF004FB4" FontWeight="Bold" FontFamily="OCR A Extended" Foreground="White" Margin="4,3,3,2" BorderBrush="{x:Null}">X</Button>

and the style:

<Style x:Key="cust_toolbox" TargetType="Button">

    <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
            <Setter Property="Background" Value="#4685d5"/>
        </Trigger>
    </Style.Triggers>

</Style>

But when the mouse hovers over the button the above style doesn't show? What would be a possible conflict?

Whirlwind991
  • 485
  • 5
  • 17
  • 1
    Possible duplicate of [How do you change Background for a Button MouseOver in WPF?](http://stackoverflow.com/questions/17259280/how-do-you-change-background-for-a-button-mouseover-in-wpf) – Fruchtzwerg Aug 08 '16 at 04:43
  • thanks for the link that did the trick – Whirlwind991 Aug 08 '16 at 05:02

1 Answers1

0

This is dependency precedence problem Dont set the background property locally in button. Because that has higher precedence. Try to set default background within the style. Check the below url for more info

Sathish V
  • 328
  • 1
  • 14
  • http://msdn.microsoft.com/en-us/library/ms743230.aspx this is the url. Sory for not adding it. – Sathish V Aug 08 '16 at 04:54
  • yep that seems to make sense, managed to fix it from the solution here http://stackoverflow.com/questions/17259280/how-do-you-change-background-for-a-button-mouseover-in-wpf – Whirlwind991 Aug 08 '16 at 05:04