<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Name="canv"> <Ellipse Name="elips" Fill="Blue" Width="8" Height="8" /> <Canvas.Triggers> <EventTrigger RoutedEvent="Canvas.SizeChanged"> <BeginStoryboard> <Storyboard TargetName="elips"> <DoubleAnimation Storyboard.TargetProperty="(Canvas.Left)" BeginTime="-0:0:1" Duration="0:0:2" RepeatBehavior="Forever" AutoReverse="True" From="0" To="{Binding ElementName=canv, Path=ActualWidth}" /> <DoubleAnimation Storyboard.TargetProperty="(Canvas.Top)" Duration="0:0:2" RepeatBehavior="Forever" AutoReverse="True" From="0" To="{Binding ElementName=canv, Path=ActualHeight}" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Canvas.Triggers> </Canvas>