Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to add a seek bar to my music player app

$
0
0

public sealed partial class MainPage : Page
    {
        
        DispatcherTimer dispatcherTimer = new DispatcherTimer();
        public MainPage()
        {
            this.InitializeComponent();

}

private void mediaeliment_MediaOpened(object sender, RoutedEventArgs e)
        {
            slider.Maximum = m.NaturalDuration.TimeSpan.TotalMilliseconds;
            ft.Text = m.NaturalDuration.ToString().Substring(0, 8);
            dispatcherTimer.Tick += dispatcherTimer_Tick;
            dispatcherTimer.Start();
        }
        private void dispatcherTimer_Tick(object sender, object e)
        {
            slider.Value = m.Position.TotalMilliseconds;
            dt.Text = "   " + m.Position.Hours
                                        + ":" + m.Position.Minutes
                                        + ":" + m.Position.Seconds + " /";
        }}

This one easy and helpful....Must try this... and vote

____________________________________________

Suryamani Behera


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>