WPF Styles Button MouseOver Question.

Posted by SO give me back my rep on Stack Overflow See other posts from Stack Overflow or by SO give me back my rep
Published on 2010-04-21T23:39:53Z Indexed on 2010/04/21 23:43 UTC
Read the original article Hit count: 1024

Filed under:
|
|

Hi, I am trying to make a simple mouseover effect on a button, It does change the color when mouse is over but the color is immediately changed to the default button background... how can I override this behavior?

this is my code:

Style myBtnStyle = new Style();
Trigger bla = new Trigger() { Property = IsMouseOverProperty, Value = true };
bla.Setters.Add(new Setter(Control.BackgroundProperty, Brushes.Black));
myBtnStyle.Triggers.Add(bla);
button2.Style = myBtnStyle;

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf