开发者

How to change the button background color on mouse over using Trigger

开发者 https://www.devze.com 2023-03-15 17:24 出处:网络
I trying to write simple code that contain button that will change the background color on mouse over.

I trying to write simple code that contain button that will change the background color on mouse over.

I want to do it using Triggers - so i write this code - but i dont know how to continue

  <Button Background="#fafafa" >
        <Button开发者_StackOverflow社区.Triggers>

            <EventTrigger RoutedEvent="Button.MouseEnter"/> 

                  // What to do here to having thi background color change ?                     

        </Button.Triggers>
    </Button>


The best way is to change Buttons template. This post describes how to do that. In buttons template under VisualStateManager you will find vsm:VisualState x:Name="MouseOver" . Change its content as you need.

Or if you want do that with triggers, than take a loot to Behaviors and Triggers in Silverlight post on silverlightshow.net.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号