views:

7

answers:

0

How do I stop a video at a specific time using Blend/WPF in C#?

Example:

When I clicked on a "TreeViewItem" called "MONDAY", the video will start to play. But up to 10sec of that video, I want it to stop. As after 10sec, that video will be showing video of another "TreeViewItem" called "TUESDAY".

And when the video is stop, the "Slider" will also stop at the specific time.

So what is the coding for it?

My coding is shown below:

    if (MONDAY.IsSelected == true) 
    { 
        Video.Source = new Uri(@".\weekday.wmv", UriKind.Relative); 
        Video.Play(); 
        descriptionText.Text = "Monday Blues"; 

       ****When video play until 10sec, the video and the slider will be stop**** 
    } 

    else if (TUESDAY.IsSelected == true) 
    { 
        TimeSpan t = TimeSpan.FromSeconds(VideoTime.Value = 10); 
        Video.Position = t; 
        descriptionText.Text = "Tuesday is here"; 
    } 

Can someone help me? Thanks.