The following forum(s) have migrated to Microsoft Q&A (Preview): Developing Universal Windows apps!
Visit Microsoft Q&A (Preview) to post new questions.

Learn More

 locked
How to know that Slider Is Captured By Finger or mouse ? RRS feed

  • Question

  • I am writing MediaPlayer

    1. I need to show progress on slider control.

    2. I need to change media position when user click on it.

    http://www.codeproject.com/Articles/142615/Custom-Media-Player-in-WPF-Part

    http://stackoverflow.com/questions/4058175/binding-a-progressbar-to-a-mediaelement-in-wpf

    Usually it is doing by timer.

    But I need to know when value changed because of user

    When it changed programmatically.

    On Desktop there is such way

    4.private void seekSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)   
    5.        {   
    6.            TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)seekSlider.Value);   
    7.  
    8.            changePostion(ts);   
    9.        }   
    10.  
    11.//mouse down on slide bar in order to seek   
    12.        private void seekSlider_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)   
    13.        {   
    14.            isDragging = true;   
    15.        }   
    16.  
    17.private void seekSlider_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)   
    18.        {   
    19.            if (isDragging)   
    20.            {   
    21.                TimeSpan ts = new TimeSpan(0, 0, 0, 0, (int)seekSlider.Value);   
    22.                changePostion(ts);   
    23.            }   
    24.            isDragging = false;   
    25.        }

    Thursday, November 10, 2016 10:05 AM

Answers

  • Hello SmartWhy,

    Welcome to the Developing Universal Windows apps forum! 
    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools .


    If you are using your own Slider class then you may need to see drag related event, for example:

    DragEnter

    For more details please tell us more things about your project. Now I can only see that you are showing WPF articles. I'm not so sure about your really problem.

    By the way, I recommend that you can check Slider class to see more details about any available events.

    (PS: In Slider we can see that there are also Point enter and Point leave, this is also the event that you can used)

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    • Edited by Barry Wang Monday, November 14, 2016 5:47 AM
    • Marked as answer by SmartWhy Monday, November 14, 2016 12:04 PM
    Friday, November 11, 2016 11:06 AM