我想在按钮上移动一个按钮,使其逐渐改变位置(动画),而不是消失并重新出现在新位置。
答案 0 :(得分:3)
您可以使用Storyboard
来顺利移动它:
<Grid>
<Canvas>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="50,250,0,0" Name="buttonAnimate" VerticalAlignment="Top" Width="75">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="100" Duration="0:0:2" Storyboard.TargetProperty="(Canvas.Left)" AutoReverse="False" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Button.Triggers>
</Button>
</Canvas>
</Grid>