--t
10 Answers, 1 is accepted
Can you please provide some more information about the problem (some code).
I set the Minimum and Maximum properties dynamically and the SelectionStart and SelectinEnd properties and it works as expected.
All the best,
Boryana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
this.xaml_planningarea.Maximum = Convert.ToDouble(dMaxNumberPlanngingArea);
this.xaml_planningarea.Minimum = Convert.ToDouble(dMinNumberPlanngingArea);
this.xaml_planningarea.SelectionStart = Convert.ToDouble(dMinNumberSelectedPlanngingArea);
this.xaml_planningarea.SelectionEnd = Convert.ToDouble(dMaxNumberSelectedPlanngingArea);
this.xaml_planningarea.UpdateLayout();
So, this code works as expected for only certain numbers. Again, here is my example. I initially set the maximum and minimum value of the slide to 5 and 10, respectively. So, the minimum is 5 and the maximum is 10.
The code DOES NOT WORK as expected when I now set the range to 2 and 3, for example. I have discovered, that if the NEW maximum value, in this case 3, is lower than the previous minimum value, in our example 5. Does that make sense?
To summaries, I start with 5-10 as my range. Setting it to, let's say, 3-7, works, because 7 > 5. But now, when I set it to 2-3, the slider does not update correctly. In this case the slider shows 2-5, instead of 2-3. It does not update the new maximun value.
thanks
--tolga
Try to follow my example. By default, the slider is set to 50 - 100. Now, enter 10 and 20 (anything where the new max value is less than than the previous min value) and hit "Update". You will notice it does not work.
Regards
--tolga koseoglu
C#
public Page()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Page_Loaded);
}
void Page_Loaded(object sender, RoutedEventArgs e)
{
this.btnUpdateSlider.Click += new RoutedEventHandler(btnUpdateSlider_Click);
this.UpdateMySlider();
}
void btnUpdateSlider_Click(object sender, RoutedEventArgs e)
{
this.UpdateMySlider();
}
void UpdateMySlider()
{
dMinimum =
Convert.ToDouble(this.txtMinimum.Text);
dMaximum =
Convert.ToDouble(this.txtMaximim.Text);
this.myslider.TickFrequency = dMaximum;
this.myslider.TickPlacement = Telerik.Windows.Controls.TickPlacement.TopLeft;
this.myslider.Maximum = dMaximum;
this.myslider.Minimum = dMinimum;
this.myslider.SelectionEnd = dMaximum;
this.myslider.SelectionStart = dMinimum;
this.myslider.UpdateLayout();
}
xaml
<
UserControl x:Class="SilverlightTestoutStuff.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerikControls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
Width="400" Height="300">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.RowDefinitions>
<RowDefinition
Height="40"></RowDefinition>
<RowDefinition
Height="*"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button
x:Name="btnUpdateSlider"
Content="Update"
Width="60"
HorizontalAlignment="Left"></Button>
<TextBox
x:Name="txtMinimum"
Text="50"
Width="30"
Height="20"></TextBox>
<TextBox
x:Name="txtMaximim"
Text="100"
Width="30"
Height="20"></TextBox>
</StackPanel>
<telerikControls:RadSlider
Margin="15,10,15,10"
VerticalAlignment="Center"
Grid.Column="1"
Grid.Row="1"
IsSelectionRangeEnabled="True"
HandlesVisibility="Visible"
x:Name="myslider"
Maximum="0">
<telerikControls:RadSlider.TickTemplate>
<DataTemplate>
<Grid>
<TextBlock
Text="{Binding}"
FontSize="10"
Foreground="Black"
FontFamily="Verdana"></TextBlock>
</Grid>
</DataTemplate>
</telerikControls:RadSlider.TickTemplate>
</telerikControls:RadSlider>
</Grid>
</
UserControl>
I reviewed you example and noticed that you set the Maximum before the Minimum value:
void UpdateMySlider()
{
dMinimum = Convert.ToDouble(this.txtMinimum.Text);
dMaximum = Convert.ToDouble(this.txtMaximim.Text);
this.myslider.TickFrequency = dMaximum;
this.myslider.TickPlacement = Telerik.Windows.Controls.TickPlacement.TopLeft;
this.myslider.Maximum = dMaximum;
this.myslider.Minimum = dMinimum;
this.myslider.SelectionEnd = dMaximum;
this.myslider.SelectionStart = dMinimum;
this.myslider.UpdateLayout();
}
You have to set the minimum before the maximum and the example should work perfectly:
this.myslider.Minimum = dMinimum;
this.myslider.Maximum = dMaximum;
You need to do so, because of a safeguard mechanism which is built into the control and prevents one from setting a Maximum value that is less than the Minimum and vice versa.
I hope this answers your question.
Regards,
Boryana
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
It seems that the UI is not updated when setting Minimum and Maximum to the same value from code. My slider's min/max value changes based on user input, and when setting first: min=1, max=10 works fine; later setting min=1, max=1 leads to no change on the slider, still showing max 10. So i guess the mentioned safeguard mechanism should handle min = max.
Thanks,
Joe
Thank you for reporting this. We will see how we can improve this for the Q2 release.
Best wishes,
Boryana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am not sure that I was able to reproduce the issue you describe. I have attached a sample project that allows you to set different values for min and max of RadSlider. Could you please take a look at the project and let me know if you are still able to reproduce the issue. I'd be glad to further assist you.
Kind regards,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
<telerik:RadSlider x:Name="slider1" Width="276" Margin="0 10" IsSnapToTickEnabled="True" BorderThickness="10,0,0,0" TickPlacement="BottomRight" > |
<telerik:RadSlider.TickTemplate> |
<DataTemplate> |
<Grid> |
<TextBlock x:Name="tickBox" Text="{Binding}" FontSize="9" Foreground="Gray" ToolTipService.ToolTip="Jump to this page." Cursor="Hand" /> |
</Grid> |
</DataTemplate> |
</telerik:RadSlider.TickTemplate> |
</telerik:RadSlider> |
Thank you for clarifying. Indeed when Minimum equals Maximum the tick is not updated. We will do our best a fix is included in our next week's Service Pack release.
All the best,
Kiril Stanoev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.