Tuesday 15 November 2011

How to show the Value inside the Thumb of Slider control in Silverlight..?

Recently I found some people keep asking this question,

"in Silverlight, How can I show the Value inside the Thumb of a Slider Control?"

well, when I tried to answer this question, I found this was not that easy to solve as I expected, so I dive deep into how the Slider control was designed originally by Microsoft an tried to find out some solution.

Now I got it, I rewrote the ControlTemplate and generated a brand new Slider which support showing the Value(or anything) inside the Thumb

Click to See the Live Demo

The screen shots are here:




When you slide the Thumb, the value 0.0 changes to be the Value property of the Slider control, like this:


How can I get this?

First let's see what is a Slider control? a Slider is a Range Control which indeed is a Control, why should I mention this? because a Control always have its own Template property, by modifying the Template property, you can "Assign" this Control different looking

in this example, i rewrote the Slider's Template(which is a ControlTemplate), so the Thumb could show the Value of the Slider




No comments:

Post a Comment