wpf - How to play translate transform in xaml? -


i have button want translate horizontally, use storyboard this:

 <button> <button.triggers>                 <eventtrigger routedevent="button.click">                     <beginstoryboard>                         <storyboard>                             <doubleanimation storyboard.targetname="studio" storyboard.targetproperty="rendertransform.(translatetransform.x)" from="0" to="5000" duration="0:0:2">                                 <doubleanimation.easingfunction>                                     <cubicease easingmode="easeinout"/>                                 </doubleanimation.easingfunction>                             </doubleanimation>                     </storyboard>                 </beginstoryboard>             </eventtrigger> </button.triggers>  </button> 

but nothing happens

nothing happens because there no translatetransform in button's rendertransform.

just add one, , remove storyboard.targetname doubleanimation :

<button ...>     <button.rendertransform>         <translatetransform/>     </button.rendertransform>     <button.triggers>         <eventtrigger routedevent="button.click">             <beginstoryboard>                 <storyboard>                     <doubleanimation                         storyboard.targetproperty="rendertransform.x"                         to="5000" duration="0:0:2">                         <doubleanimation.easingfunction>                             <cubicease easingmode="easeinout"/>                         </doubleanimation.easingfunction>                     </doubleanimation>                 </storyboard>             </beginstoryboard>         </eventtrigger>     </button.triggers> </button> 

Comments