This is a migrated thread and some comments may be shown as answers.

Suggestion for RadSlider

4 Answers 47 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 23 Jul 2008, 03:09 PM
I would like to customize the display text for each tick of the slider. Instead of just the numeric values I want the steps to have individual descriptions, such as "None", "Low", "Medium", "High" etc. While I managed to do that with some trickery involving a TextBlock in the TickTemplate, catching the "Loaded" event of that textblock, using its DataContext (double) to find the right text in my own object collection, and finally changing the Text property of the TextBlock, it would be nice if that functionality was built into the component. Hope I'm making myself understood here. If not, please ask. /Henrik

4 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 24 Jul 2008, 07:30 AM
Hello Henrik,
A more elegant way of achieving the desired outcome is the use of ValueConverter instead of TemplateSelector. Take a look at the attached example for better explanation and if you have any further questions or remarks, do not hesitate to contact us.

Kind regards,
Kiril
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
hwsoderlund
Top achievements
Rank 1
answered on 24 Jul 2008, 01:34 PM
It's certainly more elegant. However, the strings I want to display for the ticks is in an object collection which is a child of the object that the slider is bound against. The data context for the Tick object is only a double. To find my string I need access to the data context of the RadSlider itself, and I don't think I can get to that in the ValueConverter.
0
Accepted
Kiril Stanoev
Telerik team
answered on 25 Jul 2008, 06:39 AM
Hello Henrik,

One way of reaching RadSlider's DataContext is to create a public property in the converter class. Then whenever you set the DataContext, get the converter from the resources and set the property mentioned above to point to that DataContext. For better understanding see the sample project I have attached.
If you have any additional questions, contact us as soon as possible.

Kind regards,
Kiril
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
hwsoderlund
Top achievements
Rank 1
answered on 25 Jul 2008, 07:34 AM
Yeah, you're right, that should work. Good stuff. Thanks.
Tags
General Discussions
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
hwsoderlund
Top achievements
Rank 1
Share this question
or