I recently needed to create a scrolling text in a WPF application. After I did some digging, I found it and thought that I would post here to share. I’ve added my own touches to it, so the original source has been modified.
<TextBlock Grid.Row="2" FontSize="22" Name="txtScrolling">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="translate" />
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard>
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
From="1200" To="-1200"
Storyboard.TargetName="translate"
Storyboard.TargetProperty="X"
Duration="0:0:9" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
This is the Text to Scroll
</TextBlock>
Image the text below is scrolling to get an idea what the XAML does. =)
