开发者

How to move a StackPanel in WPF

I would like to move a StackPanel horizontally when the user clicks a button. I'm开发者_Go百科 implementing DoubleAnimation with TargetName and TargetProperty. But, I don't know which TargetProperty to use.

Can anyone help me?


If you put the StackPanel inside a Canvas you can achieve this behavior by setting the Canvas.X and Canvas.Y properties. Alternatively you could animate the Margin of the StackPanel by using ThicknessAnimation. Check out this post for a similar request.


Another method would be a TranslateTransform applied to the RenderTransform of the StackPanel. The TargetProperty path for the animation then would be RenderTransform.X.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜