I would like to animate my Label inside of canvas from canvas right to canvas left + size of label, infinitely. Which means my label comes from the right side and goes to the left till the end and then again repeats.
This is my xaml:
<Canvas Margin="0, 0, 0, 20" Name="CanMain2" Height="30" Width="350" >
<Label x:Name="LabelNameSong" Content="Hello" >
<Label.Resources>
<Storyboard x:Key="Scroll">
<DoubleAnimation To="{Binding ActualWidth, ElementName=LabelNameSong}" Duration="00:00:10"
Storyboard.TargetProperty="(Canvas.Right)"
Storyboard.TargetName="LabelNameSong"
RepeatBehavior="Forever"/>
</Storyboard>
</Label.Resources>
<Label.Triggers>
<EventTrigger RoutedEvent="Label.Loaded">
<BeginStoryboard Storyboard="{StaticResource Scroll}" />
</EventTrigger>
<EventTrigger RoutedEvent="Label.SizeChanged">
<BeginStoryboard Storyboard="{StaticResource Scroll}" />
</EventTrigger>
</Label.Triggers>
</Label>
</Canvas>
As soon as I launch app it crashes, and debugger says:
Cannot animate the 'Right' property on a 'System.Windows.Controls.Label' using a 'System.Windows.Media.Animation.DoubleAnimation'. For details see the inner exception.
I am new to xaml and can't seem to make this work.