Button template, title Jitter

Source: Internet
Author: User

<controltemplate targettype="{x:type Button}"> <border x:name="Btn_border"Background="{TemplateBinding Background}"> <textblock x:name="Btn_text"opacity="0"rendertransformorigin="0.5,0.5"text="{TemplateBinding Content}"Fontsize=" -"fontfamily="Candara"Foreground="Red"fontweight="Normal"Horizontalalignment="Center"Verticalalignment="Top"margin="0 5 0 0"> <TextBlock.RenderTransform> <rotatetransform>& Lt;/rotatetransform> </TextBlock.RenderTransform> </textbloc k> </Border> <ControlTemplate.Triggers> <tr Igger property="IsMouseOver"Value="True"> <setter property="Cursor"Value="Hand"Targetname="Btn_border"/> <setter property="Opacity"Value="1"Targetname="Btn_text"> </Setter> </Trigger> <eventtr Igger routedevent="Button.mouseenter"> <EventTrigger.Actions> <BeginStoryboard> <storyboard > <doubleanimation Storyboard.ta Rgetname="Btn_text"Storyboard.TargetProperty="Rendertransform.angle"BeginTime="00:00:00"From="0"to="5"duration="00:00:0.1"AutoReverse="True"Repeatbehavior="Forever"/> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> &L T EventTrigger routedevent="Button.mouseleave"> <BeginStoryboard> <Storyboard> <doubleanimation storyboard.targetname="Btn_text"storyboard.targetproperty="Rendertransform.angle"BeginTime="00:00:00"From="0"to="0"duration="00:00:0.1"Autoreverse="True"/> </Storyboard> </BeginStoryboard> </EventTrigger> </ControlTemplate.Triggers> &LT;/CONTROLTEMPLATE&G T

The key is to declare the element center Rendertransformorigin (0.5,0.5) within the element that needs to be transformed

<xx. Rendertransform>

<RotateTransform></RotateTransform>

</xx. Rendertransform>

Then define the routed event control in <Template.Tragers>, define the storyboard, trigger

Button template, title Jitter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.