WPF C# Tutorial

  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="" Height="300" Width="600">
    
        
            
                
            

            
                
                    
                        
                                            RepeatBehavior="Forever">
                                
                                    
                                

                            
                        
                    
                
            

        
        
            
                
                    
                
                
                    
                
            

        
    


//File:Window.xaml.cs
using System;
using System.Windows;
using System.Windows.Media.Animation;
using System.Windows.Input;
namespace WpfApplication1
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
        private void Storyboard_Changed(object sender, System.EventArgs e)
        {
            ClockGroup clockGroup = sender as ClockGroup;
            AnimationClock animationClock = clockGroup.Children[0] as AnimationClock;
            if (animationClock.CurrentProgress.HasValue)
            {
                Seeker.Value = animationClock.CurrentProgress.Value;
            }
        }
        private void Seeker_ValueChanged(object sender, RoutedPropertyChangedEventArgs e)
        {
            Storyboard.Seek(Rectangle,
                            TimeSpan.FromTicks((long)(Storyboard.Children[0].Duration.TimeSpan.Ticks * Seeker.Value)),
                            TimeSeekOrigin.BeginTime);
        }
    }
}