How to set MouseOver event/trigger for border in XAML?

前端 未结 1 1087
臣服心动
臣服心动 2020-11-28 07:29

I want the border to turn green when the mouse is over it and then to return to blue when the mouse is no longer over the border.

I attempted this without any luck:

1条回答
  •  遥遥无期
    2020-11-28 07:56

    Yes, this is confusing...

    According to this blog post, it looks like this is an omission from WPF.

    To make it work you need to use a style:

        
            
                
            
            
        
    

    I guess this problem isn't that common as most people tend to factor out this sort of thing into a style, so it can be used on multiple controls.

    0 讨论(0)
提交回复
热议问题