Binding to Slider SelectionStart and SelectionEnd not working?

3 posts, 1 answers
  1. Rob A.
    Rob A. avatar
    62 posts
    Member since:
    Nov 2019

    Posted 05 Nov 2020 Link to this post

    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. Answer
    Dinko
    Admin
    Dinko avatar
    1220 posts

    Posted 10 Nov 2020 Link to this post

    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/.

  3. Rob A.
    Rob A. avatar
    62 posts
    Member since:
    Nov 2019

    Posted 10 Nov 2020 in reply to Dinko Link to this post

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

    Cheers, Rob.

Back to Top