This, move my TextBlock to left to rigth, but if I do my window larger, does not work. What Can I do? I have this code, it works for Windows FOrm, but in WPF it not
WPF C#
DoubleAnimation doubleAnimation = new DoubleAnimation();
doubleAnimation.From = this.ActualWidth;
doubleAnimation.To = this.ActualWidth;
doubleAnimation.RepeatBehavior = RepeatBehavior.Forever;
doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
marquee.BeginAnimation(Canvas.RightProperty, doubleAnimation);
XAML
<Canvas>
<TextBlock Name="marquee" FontSize="30" Text="Sample Marquee" Canvas.Left="8" Canvas.Top="437" />
<Button Width="100" Height="50" Content="Marquee" Click="Button_Click" Canvas.Left="6" Canvas.Top="144" />
</Canvas>
A similar code that it work (For Windows Form) is:
private void timer1_Tick(object sender, EventArgs e)
{
this.Refresh();
myLabel2.Left += 15;
if (myLabel2.Left >= this.Width)
{
myLabel2.Left = myLabel2.Width * -1;
}
}