hello, i am making an mp3 player and i have this code which works fine when i'm trying to set the position of the current playing file.
what i don't know is how to make the slider control to automatically slide when i click the play file.
this is the code i have:
DoubleAnimation animatie = new DoubleAnimation();
animatie.Duration = player.NaturalDuration;
player.Pause();
player.Position = TimeSpan.FromSeconds(slider_position.Value);
player.Play();
if (player.NaturalDuration.HasTimeSpan)
{
slider_position.Minimum = 0;
slider_position.Maximum = player.NaturalDuration.TimeSpan.TotalSeconds;
}
i hope i made myself clear enough
Make a slider control to "slide" automatically while playing mp3 file
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Roei BarRank #1,271 · 1.4K reputationPosted Aug 22, 2009, 12:40 AM EDT
well the Sliding Play moovs on Iterations of 1000 Ticks meaning you need to create a timer on your application and run it on 1000 interval.
on each time the Event is Fired you will need to run the animation code.
hope this helps...
if so dont forget to mark this as "Accepted Answer"
bodnar edmond8 reputationPosted Aug 23, 2009, 3:06 AM EDT
bodnar edmond8 reputationPosted Aug 24, 2009, 12:04 AM EDT
timer = new DispatcherTimer();
timer.Interval = new TimeSpan(0, 0, 0, 0, 1000);
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
thanks for your help