wpf 如何让控件左右移动
作者:互联网
原文:wpf 如何让控件左右移动
通过DoubleAnimation可以让控件进行左右移动。
<Canvas x:Name="canvas_Shape" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="720" Margin="12,0" Grid.Column="1" Grid.RowSpan="7" > <Canvas.Triggers> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard > <Storyboard Storyboard.TargetName="bendediction" Storyboard.TargetProperty="(Canvas.Left)"> <DoubleAnimation From="0" To="400" Duration="0:0:10" RepeatBehavior="23:59:59" AutoReverse="True"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Canvas.Triggers> <Button x:Name="bendediction" Style="{DynamicResource ButtonStyle}" Canvas.Top="200"/> </Canvas>
效果如下:
标签:控件,左右,如何,DoubleAnimation,wpf,移动 来源: https://www.cnblogs.com/lonelyxmas/p/10534132.html