WPF VB.Net

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="WPF" Height="450" Width="300">
    
        
            
                
                    
                                                            CurrentTimeInvalidated="Storyboard_Changed">
                                                             Storyboard.TargetName="meMediaElement"
                                 RepeatBehavior="Forever" />
                        
                    
                

            
            
                
                    
                

            
            
                
                    
                

            
            
                
                    
                

            
                                          SourceName="sldPosition" >
                
            
                                          SourceName="sldPosition" >
                
            
        

                              Margin="5" MinHeight="300" Stretch="Fill"
                      MediaOpened="MediaOpened" />
        
        
        
        
                        Name="sldPosition" Width="250"
                ValueChanged="sldPosition_ValueChanged">
        
        
        
        
        
    

//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Animation
Namespace WpfApplication1
  Public Partial Class Window1
    Inherits Window
    Private ignoreValueChanged As Boolean = False
    Public Sub New()
      InitializeComponent()
    End Sub
    Private Sub MediaOpened(sender As Object, e As EventArgs)
      sldPosition.Maximum = meMediaElement.NaturalDuration.TimeSpan.TotalMilliseconds
    End Sub
    Private Sub Storyboard_Changed(sender As Object, e As EventArgs)
      Dim clockGroup As ClockGroup = TryCast(sender, ClockGroup)
      Dim mediaClock As MediaClock = TryCast(clockGroup.Children(0), MediaClock)
      If mediaClock.CurrentProgress.HasValue Then
        ignoreValueChanged = True
        sldPosition.Value = meMediaElement.Position.TotalMilliseconds
        ignoreValueChanged = False
      End If
    End Sub
    Private Sub sldPosition_ValueChanged(sender As Object, e As RoutedPropertyChangedEventArgs(Of Double))
      If ignoreValueChanged Then
        Return
      End If
      Storyboard.Seek(Panel, TimeSpan.FromMilliseconds(sldPosition.Value), TimeSeekOrigin.BeginTime)
    End Sub
  End Class
End Namespace