locked
Is it possible to animate the Thumb element of a slider

    Question

  • I've created a custom style for my sliders to match my applications behavior and appearance, that's all working fine. Now what I want to do is perform some animation on the slider's thumb to change the background when the value of the slider reaches the center point. The only way I can think of doing this is in the ValueChanged event handler. The problem is that the Thumb element in the slider style is not exposed as a property of the slider, so I have no direct access to it. How would I accomplish this? Would I need to create a whole new custom control based on the Slider class and expose the Thumb as a property, or is there a way to do this through templating?

    Thanks

    Tuesday, February 26, 2013 4:04 AM

Answers

  • You may have to walk the control's visual tree to find the Thumb. You may be able to fiddle with the template to trigger your own states to alter its colouring.

    --Rob

    Wednesday, February 27, 2013 1:55 AM
    Owner

All replies

  • You may have to walk the control's visual tree to find the Thumb. You may be able to fiddle with the template to trigger your own states to alter its colouring.

    --Rob

    Wednesday, February 27, 2013 1:55 AM
    Owner
  • Thanks, Rob

    I was able walk the visual tree and find the Thumb element using the VisualTreeHelper class.

    Wednesday, February 27, 2013 5:16 AM