Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:05:18+00:00 2026-06-02T03:05:18+00:00

Tried binding Maximum value of slider to media element’s duration and binding slider’s current

  • 0

Tried binding Maximum value of slider to media element’s duration and binding slider’s current value to the position of media element, but but for some reasons it doesn’t.

I want the slider to move it’s thumb while the video is playing.

<Slider x:Name="videoSlider" Value="{Binding ElementName=mp3MediaElement, Path=Position}" 
ValueChanged="videoSlider_ValueChanged" IsMoveToPointEnabled="True" 
Maximum="{Binding ElementName=mp3MediaElement, Path=NaturalDuration}" 
AllowDrop="True" DataContext="{Binding ElementName=mp3MediaElement}" />
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:05:18+00:00Added an answer on June 2, 2026 at 3:05 am

    I didn’t use binding..
    I had a similar issue and used timer for this (My code is in Silverlight by it suppose to be the same on WPF):

    First direction (movie updates the slider)

    private TimeSpan TotalTime;
    
    private void MyMediaElement_MediaOpened(object sender, RoutedEventArgs e)
            {
                TotalTime = MyMediaElement.NaturalDuration.TimeSpan;
    
                // Create a timer that will update the counters and the time slider
                timerVideoTime = new DispatcherTimer();
                timerVideoTime.Interval = TimeSpan.FromSeconds(1);
                timerVideoTime.Tick += new EventHandler(timer_Tick);
                timerVideoTime.Start();
            }
    
    void timer_Tick(object sender, EventArgs e)
            {
                // Check if the movie finished calculate it's total time
                if (MyMediaElement.NaturalDuration.TimeSpan.TotalSeconds > 0)
                {
                    if (TotalTime.TotalSeconds > 0)
                    {
                        // Updating time slider
                        timeSlider.Value = MyMediaElement.Position.TotalSeconds /
                                           TotalTime.TotalSeconds;
                    }
                }
            }
    

    Second direction (user updates the slider)
    on form ctor or something like this write the following line:

    timeSlider.AddHandler(MouseLeftButtonUpEvent, 
                          new MouseButtonEventHandler(timeSlider_MouseLeftButtonUp), 
                          true);
    

    and the event handler is:

    private void timeSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
            {
                if (TotalTime.TotalSeconds > 0)
                {
                    MyMediaElement.Position = TimeSpan.FromSeconds(timeSlider.Value * TotalTime.TotalSeconds);
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried for unload and beforeunload binding in following code, but none of
I have a slider with minimum value 0 and maximum value 1 . When
<ProgressBar Foreground=Red Background=Transparent Value={Binding NumFailed, Mode=OneWay} Minimum=0 Maximum={Binding NumTubes, Mode=OneWay, Converter={x:Static wpftools:DebuggingConverter.Instance}, ConverterParameter=Failedprogressbar} FlowDirection=RightToLeft
Appears that WAS does not support the integration binding. I've tried setting it up
xaml side: <DataGrid Name=MyGrid ItemsSource={Binding} /> I tried also with: <DataGrid Name=MyGrid ItemsSource={Binding MyObj}
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
I tried binding ADAM with DirectoryContext adamContext = new DirectoryContext(); To use ActiveDirectorySchema schema
I've read up on binding to other classes but the syntax is tripping me
I have two Devexpress gridview in a page. I tried binding data to devexpress
Using PyCrypto (although I've tried this in ObjC with OpenSSL bindings as well) :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.