3

I'm using a Slider control to allow the user to seek to a specific position in a video stream. I bound the Value property of the Slider to the Position property of a MediaElement.

My problem is that when the user drags the slider's thumb, the MediaElement begins seeking to the new position immediately, but I'd like to defer seeking until the user releases the thumb. I'd like to update the binding only after the user stops dragging the thumb (or detect when this happen and update the player position manually, not necessarily using a binding)

Is it possible, and how? As a last resort, I'll probably create a custom control and use it instead of the Slider, but I'd prefer a solution that uses a Slider.

Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
  • possible duplicate of [WPF: Slider with an event that triggers after a user drags](http://stackoverflow.com/questions/723502/wpf-slider-with-an-event-that-triggers-after-a-user-drags) – ChrisWue Sep 06 '13 at 10:16
  • @ChrisWue, this is not a duplicate, since my question isn't about WPF, but maybe it can help anyway. Thanks! – Thomas Levesque Sep 06 '13 at 11:18

2 Answers2

1

Go through the events in the link

Slider clsss

and use the mouseleftbuttonup and down event on your slider to check for touch release. In buttonup seek the video to the slider correct video.

Anobik
  • 4,841
  • 2
  • 17
  • 32
  • Thanks! Actually I just used the PointerReleased event. I had to subscribe manually in code to receive the event after it had been handled by the control, since by default handled events don't bubble up. – Thomas Levesque Oct 03 '13 at 10:30
  • Happy to help. And I forgot .. Mouse was in silverlight and in metro its pointer :-) – Anobik Oct 03 '13 at 10:41
0

Finally Slider is a xaml control so detecting its mouse pressed events should do. Like mouseleftbutton UP and DOWN events. In the UP event Note the position of the slider and change the value of the video accordingly.

Pratim
  • 75
  • 1
  • 10