<Window x:Class="WpfApplication1.SimpleAnimation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Simple Animation Example" Height="300" Width="300"> <Canvas> <Rectangle x:Name="rect1" Width="100" Height="50" Fill="Blue"/> </Canvas> </Window> //File:Window.xaml.vb Imports System Imports System.Windows Imports System.Windows.Controls Imports System.Windows.Media Imports System.Windows.Shapes Imports System.Windows.Media.Animation Namespace WpfApplication1 Public Partial Class SimpleAnimation Inherits Window Public Sub New() InitializeComponent() Dim da As New DoubleAnimation() da.From = 0 da.[To] = 200 da.Duration = TimeSpan.FromSeconds(5) da.AutoReverse = True da.RepeatBehavior = RepeatBehavior.Forever rect1.BeginAnimation(Canvas.LeftProperty, da) rect1.BeginAnimation(Canvas.TopProperty, da) End Sub End Class End Namespace