<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" BorderThickness="0" Height="36">
<Canvas Loaded="MarqueeControl_Loaded" Width="592" HorizontalAlignment="Left">
<Canvas.Resources>
<Storyboard x:Name="sb">
<DoubleAnimation x:Name="da" BeginTime="00:00:02" Storyboard.TargetName="txtLorem" Storyboard.TargetProperty="(Canvas.Left)" From="0" RepeatBehavior="Forever"/>
</Storyboard>
</Canvas.Resources>
<TextBlock x:Name="txtLorem" Width="596" Height="33" Text="滚动文字内容..."/>
</Canvas>
</ScrollViewer>
void MarqueeControl_Loaded(object sender, RoutedEventArgs e)
{
var canvas = sender as Canvas;
if (txtLorem.ActualWidth <= canvas.Width) return;
const double speed = 50;
da.To = -txtLorem.ActualWidth;
da.Duration = new Duration(TimeSpan.FromSeconds(txtLorem.ActualWidth / speed));
sb.Begin();
}