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

slider Template issue

1 Answer 92 Views
Slider
This is a migrated thread and some comments may be shown as answers.
dCODE
Top achievements
Rank 1
dCODE asked on 23 Feb 2010, 06:09 AM
Hi

 i need to create make my slider dynamic. so i need to change my maximum value for each 5 mins, so am trying to  bind my maximum and minimum value(DateTime) from database. here am facing problem,that i cannot bind the values in minimum,maximum and in the textblock, i cant even call the biniding function here, please tel me how to call and bind my values to the slider

 

<

 

telerik:RadSlider Minimum="{Binding {StaticResource MinValue}}" Maximum="{Binding {StaticResource MaxValue}}" TickFrequency="1" TickPlacement="BottomRight" IsSnapToTickEnabled="True" Margin="133,175,114,204">

 

 

 

 

 

 

 

<telerik:RadSlider.TickTemplate>

 

 

 

 

 

 

 

<DataTemplate>

 

 

 

 

 

 

 

<StackPanel>

 

 

 

<Ellipse Width="5" Height="5" Fill="Black" HorizontalAlignment="Center"/>

 

 

 

<TextBlock Text="{Binding}" FontSize="10"/>

 

 

 

</StackPanel>

 

 

 

 

 

 

 

</DataTemplate>

 

 

 

 

 

 

 

</telerik:RadSlider.TickTemplate>

 

 

 

 

 

 

 

</telerik:RadSlider>

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Kiril Stanoev
Telerik team
answered on 25 Feb 2010, 09:37 AM
Hi dCODE,

The Maximum and Minimum values of RadSlider are of type double. Therefore, if MinValue and MaxValue are of type DateTime, you will need to use a converter to pass a valid double value when binding.
The way RadSlider works is that the data context of each tick is the value at the corresponding position. Therefore, if you want to convert the double value to a DateTime and show it in the TextBox, you will have to use another converter. I have attached a sample project demonstrating this functionality. Currently, when using a Converter in the TickTemplate causes the RadSlider to not measure its ticks properly. This limitation will be fixed for our official release, which is scheduled for the mid of March. Have a look at it and let me know if you have additional questions or comments on the topic.

Best wishes,
Kiril Stanoev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Slider
Asked by
dCODE
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or