storyboard - wpf ObjectAnimationUsingKeyFrames setting the left value -


in wpf, i'm trying move image left center, pause second, move image right. i'm trying achieve using objectanimationusingkeyframes.

<beginstoryboard>   <storyboard storyboard.targetname="roundnumbertext" >     <objectanimationusingkeyframes duration="0:0:1" storyboard.targetproperty="left">         <discreteobjectkeyframe  value="400" keytime="0:0:0.5"/>         <discreteobjectkeyframe  value="1400" keytime="0:0:1.5"/>     </objectanimationusingkeyframes>   </storyboard> </beginstoryboard> 

somehow got error message on targetproperty object not supported properties. i've tried margin well, still giving error. appreciate if help.

to set value alignment, need this:

<objectanimationusingkeyframes storyboard.targetname="myimage"                                 storyboard.targetproperty="horizontalalignment">      <discreteobjectkeyframe keytime="0:0:0">         <discreteobjectkeyframe.value>             <horizontalalignment>center</horizontalalignment>         </discreteobjectkeyframe.value>     </discreteobjectkeyframe> </objectanimationusingkeyframes> 

below example, image appears in role of label:

<grid>     <grid.triggers>         <eventtrigger sourcename="movetocenter" routedevent="button.click">             <beginstoryboard>                 <storyboard>                     <objectanimationusingkeyframes storyboard.targetname="test"                                                     storyboard.targetproperty="horizontalalignment">                          <discreteobjectkeyframe keytime="0:0:0">                             <discreteobjectkeyframe.value>                                 <horizontalalignment>center</horizontalalignment>                             </discreteobjectkeyframe.value>                         </discreteobjectkeyframe>                     </objectanimationusingkeyframes>                      <objectanimationusingkeyframes begintime="0:0:1"                                                    storyboard.targetname="test"                                                     storyboard.targetproperty="horizontalalignment">                          <discreteobjectkeyframe keytime="0:0:0">                             <discreteobjectkeyframe.value>                                 <horizontalalignment>right</horizontalalignment>                             </discreteobjectkeyframe.value>                         </discreteobjectkeyframe>                     </objectanimationusingkeyframes>                 </storyboard>             </beginstoryboard>         </eventtrigger>     </grid.triggers>      <label x:name="test" content="test" width="300" height="200" background="aqua" horizontalalignment="left" />      <button name="movetocenter" content="movetocenter" width="120" height="30" horizontalalignment="right" verticalalignment="bottom" /> </grid> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -