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
.
精彩评论