开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜