SelectionStart="{Binding Rules.Min, Mode=TwoWay}"
SelectionEnd="{Binding Rules.Max, Mode=TwoWay}"
TickFrequency="5"
IsSnapToTickEnabled="True"
IsSelectionRangeEnabled="True"
My issue is when I change the SelectionEnd from 20 to 50 and then "cancel" that value setting it back to 20 in the codebehind the next time I move the end thumb it jumps back up to 50 when I would expect it to go to 25. I have a sample project I can attach but don't see a place for it. I am using version 2011.2.1010.1040 of Telerik.Windows.Controls.
5 Answers, 1 is accepted
Could you please try to use the Selection property (of type SelectionRange<double>) of the the RadSlider, instead of SelectionStart and SelectionEnd ? We recently fixed some issues when binding the SelectionStart and SelectionEnd, but we highly suggest you to use the Selection property instead. With the upcoming Q3 Release , we will introduce these fixes among with documentation describing how to bind and use the Selection successfully.
Best wishes,Petar Mladenov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
I tried binding to the Selection and it still behaves the same. I have supplied the code for my sample project so you can see what I am trying to do.
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
StackPanel
x:Name
=
"Panel"
x:FieldModifier
=
"public"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"100"
/>
<
ColumnDefinition
Width
=
"300"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"50"
/>
</
Grid.RowDefinitions
>
<
Button
Content
=
"Copy Old Value"
Click
=
"Button_Click"
Grid.Column
=
"0"
/>
<
telerik:RadSlider
x:Name
=
"Slider"
x:FieldModifier
=
"public"
TickPlacement
=
"BottomRight"
VerticalAlignment
=
"Bottom"
SelectionStart
=
"0"
Selection
=
"{Binding Rules.Selection, Mode=TwoWay}"
TickFrequency
=
"5"
IsSnapToTickEnabled
=
"True"
IsSelectionRangeEnabled
=
"True"
Minimum
=
"0"
Maximum
=
"50"
Margin
=
"10,0,10,0"
Grid.Column
=
"2"
>
<
telerik:RadSlider.TickTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding}"
FontSize
=
"10"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadSlider.TickTemplate
>
</
telerik:RadSlider
>
</
Grid
>
</
StackPanel
>
</
Grid
>
{
private Weight weightVO = new Weight();
public Weight WeightVO
{
get { return weightVO; }
set { weightVO = value; }
}
public MainPage()
{
InitializeComponent();
Panel.DataContext = WeightVO.Temp;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
WeightVO.SetTempToCurrent();
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
{
private Search current = DefaultSearch();
public Search Current
{
get { return current; }
set { current = value; }
}
private Search temp = DefaultSearch();
public Search Temp
{
get { return temp; }
set { temp = value; }
}
public void SetTempToCurrent()
{
Temp.CopyValues(Current);
}
public static Search DefaultSearch()
{
Rules rules = new Rules() {End = 5d, Selection = new SelectionRange<double>(0, 5)};
return new Search() { Rules = rules };
}
}
public class Search : INotifyPropertyChanged
{
private Rules rules = new Rules();
public Rules Rules
{
get { return rules; }
set
{
rules = value;
OnPropertyChanged("Rules");
}
}
public void CopyValues(Search search)
{
Rules = new Rules(search.Rules);
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
public class Rules : INotifyPropertyChanged
{
private double end;
public double End
{
get { return end; }
set
{
end = value;
OnPropertyChanged("End");
}
}
private SelectionRange<
double
> selection = new SelectionRange<
double
>(0, 5);
public SelectionRange<
double
> Selection
{
get { return selection; }
set
{
selection = value;
End = selection.End;
OnPropertyChanged("Selection");
}
}
public Rules() { }
public Rules(Rules rules)
{
end = rules.end;
selection = rules.selection;
}
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
}
Thank you for providing the code snippet. We have managed to create a sample application based on the code snippets. Is it possible to send us some steps to reproduce the issue using this code and what is the expected result. Thank you.
All the best,
Alex Fidanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Steps to reproduce:
Move end slider from 5 to 30
Click Copy Old Value Button - should cause end slider to move back to 5
Move end slider again
Actual Results
End slider jumps back to 30
Expected
End slider jumps to 10
Thank you for reporting this. We have acknowledged this as an issue in the slider control. I have logged this in our PITS unde "Incorrect range after changing the value and dragging a thumb" and you will be able to track it in the system within one day. I have also updated your Telerik points.
All the best,
Alex Fidanov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>