.net - Resize WPF UserControl without all children "jumping around" -


is there way resize wpf usercontrol in such way child controls don't flop around?

i've got storyboard:

<storyboard>     <doubleanimation storyboard.targetproperty="height" storyboard.targetname="myusercontrol" to="145" from="0" duration="0:0:1" /> </storyboard> 

this works great; takes control height 0 height 145 -- problem height property changes, of child controls inside start jumping around, suspect, due horizontalalignment , verticalalighment properties. there way can disable until animation finished?

i'm trying create illusion of usercontrol "sliding" view -- i'm open other approaches if i'm going wrong.

everything "jumping around" because every time height of control changed containing controls reposition according new available space.

to achieve desired effect should use rendertransform instead of changing actual height of control.

here how can that. first, add scaletransform value of rendertransform property on control:

<myusercontrol.rendertransform>     <scaletransform scaley="0" /> </myusercontrol.rendertransform> 

then, modify target property of animation change scaley property of transform:

<storyboard>     <doubleanimation storyboard.targetproperty="rendertransform.(scaletransform.scaley)" storyboard.targetname="myusercontrol" to="145" duration="0:0:1" /> </storyboard> 

update:

another way achieve slide-into-view effect use translatetransform negative y value:

<myusercontrol.rendertransform>    <translatetransform y="-1000" /> </myusercontrol.rendertransform> 

and then, animate y property 0:

<storyboard>     <doubleanimation storyboard.targetproperty="rendertransform.(translatetransform.y)" storyboard.targetname="myusercontrol" to="0" duration="0:0:1" /> </storyboard> 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -