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

Binding to Slider SelectionStart and SelectionEnd not working?

2 Answers 32 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Rob A. asked on 05 Nov 2020, 09:13 PM

I read many threads on this issue and I'm just trying to do simple XAML only binding and not MVVM or code behind, but unfortunately I can't get it to work with RadSlider:

<TextBox Grid.Row="5" Grid.Column="4" Text="{Binding ElementName=slHeightRange,Path=SelectionStart}" HorizontalAlignment="Right" />
<telerik:RadSlider x:Name="slHeightRange" Grid.Row="5" Grid.Column="5" Grid.ColumnSpan="1" Minimum="1" Maximum="50" HandlesVisibility="Visible" TickFrequency="5" TickPlacement="BottomRight" IsSelectionRangeEnabled="True">
    <telerik:RadSlider.Thumbs>
        <telerik:RangeSliderThumb RangeStart="5" RangeEnd="19"/>
    </telerik:RadSlider.Thumbs>
</telerik:RadSlider>
<telerik:Label Grid.Row="5" Grid.Column="6" Content="{Binding ElementName=slHeightRange,Path=SelectionEnd}" HorizontalAlignment="Right" />

 

Any hints?

Cheers, Rob.

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dinko
Telerik team
answered on 10 Nov 2020, 09:19 AM

Hi Robin,

Thank you for the provided code snippet.

The SelectionStart and SelectionEnd properties of the RadSlider will be set when using the default range selection. Adding RangeSliderThumb will be equal to set the IsSelectionRangeEnabled to false. In your case, you can use the same code but bind to the RangeSliderThumb element RangeStart and RangeEnd properties.

<TextBox Grid.Row="5" Grid.Column="4" Text="{Binding ElementName=thumb,Path=RangeStart}" HorizontalAlignment="Right" />
<telerik:RadSlider x:Name="slHeightRange" Grid.Row="5" Grid.Column="5" Grid.ColumnSpan="1" Minimum="1" Maximum="50" HandlesVisibility="Visible" TickFrequency="5" TickPlacement="BottomRight" IsSelectionRangeEnabled="True" SelectionChanged="slHeightRange_SelectionChanged">
    <telerik:RadSlider.Thumbs>
        <telerik:RangeSliderThumb x:Name="thumb" RangeStart="5" RangeEnd="19"/>
    </telerik:RadSlider.Thumbs>
</telerik:RadSlider>
<telerik:Label Grid.Row="5" Grid.Column="6" Content="{Binding ElementName=thumb,Path=RangeEnd}" HorizontalAlignment="Right" />

Regards,
Dinko
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products, quickly just got a fresh new look + new and improved content, including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 11 Nov 2020, 02:14 AM

Thanks Dinko, that solved it ... also discovered telerik:Label does support StringFormat, but TextBox does so all good.

Cheers, Rob.

Tags
Slider
Asked by
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Dinko
Telerik team
Rob A.
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or