Building a progress bar for Silverlight MediaElement
I want a simple progress bar and a time label that shows the current position of the movie. Google gave me a few examples using Javascript: I really don't want to do that. The key thing开发者_StackOverflow社区 is to keep the progress bar and time updated througout the movie. Where can I find that event?
There is no event to hook into.
Instead user a Timer to periodically check MediaElement.Position
for the MediaElement's current position and update your progress bar.
Something like:
private void timer_Tick(object sender, EventArgs e)
{
TimeSpan currentPosition = Media1.Position;
this.Slider1.Value == currentPosition.TotalSeconds
}
精彩评论