摘要:[WPF] 跑馬燈範例
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" x:Name="win">
<Window.Triggers>
<EventTrigger RoutedEvent="Window.SizeChanged">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="a"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
From="{Binding Width, ElementName=win}"
To="-10"
Duration="0:0:5"
RepeatBehavior="Forever">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Window.Triggers>
<Grid>
<TextBlock x:Name="a" Text="A">
<TextBlock.RenderTransform>
<TranslateTransform />
</TextBlock.RenderTransform>
</TextBlock>
</Grid>
</Window>