RadSlider SelectionEnd problem

2 posts, 0 answers
  1. Yuval
    Yuval avatar
    1 posts
    Member since:
    Feb 2012

    Posted 16 Mar 2013 Link to this post

    Hi,
    I am using RadSlider, with range defined as follows:
    telerik:RadSlider  Grid.Column="1"  VerticalAlignment="Center"
                                        Minimum="{Binding MinVal, Mode=OneWay}"
                                        Maximum="{Binding MaxVal, Mode=OneWay}"
                                        IsSelectionRangeEnabled="True"
                                        IsCoercionSuppressed="True"
                                        SelectionStart="{Binding LowValue, Mode=TwoWay}"
                                        SelectionEnd="{Binding HighValue, Mode=TwoWay}"
                                        StepAction="MoveRange"
                                        />
     
    <telerik:RadNumericUpDown Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center"  Margin="2" IsInteger="True" Value="{Binding LowValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
     
    <telerik:RadNumericUpDown Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center"  Margin="2" IsInteger="True" Value="{Binding HighValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
    and everything works fine.
    But- when put inside a Data template, so I can have it on an itemsconrol, I get the SelectionEnd not binded at all.
    Using Snoop, shows that the SelectionStart is binding to the ParentTemplate and works fine, but the SelectionEnd is 'Local'. Using the Clear/Reset in Snoop's menu- it starts working.

    The data template for reference:
    <DataTemplate x:Key="RangeSlider">
                <Grid Height="30" Margin="2, 0, 2, 0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="30*"/>
                        <ColumnDefinition Width="30*"/>
                        <ColumnDefinition Width="20*"/>
                        <ColumnDefinition Width="20*"/>
                    </Grid.ColumnDefinitions>
                    <TextBlock Grid.Column="0" Margin="2" VerticalAlignment="Center" Text="{Binding Name}" />
                    <telerik:RadSlider  Grid.Column="1" Margin="2" VerticalAlignment="Center"
                                        IsSelectionRangeEnabled="True"
                                        Minimum="{Binding MinVal, Mode=OneWay}"
                                        Maximum="{Binding MaxVal, Mode=OneWay}"
                                        IsCoercionSuppressed="True"
                                        SelectionEnd="{Binding HighValue, Mode=TwoWay}"
                                        SelectionStart="{Binding LowValue, Mode=TwoWay}"
                                        StepAction="MoveRange"
                                        />
                     
                    <telerik:RadNumericUpDown Grid.Column="2" HorizontalAlignment="Stretch" VerticalAlignment="Center"  Margin="2" IsInteger="True"
                             Value="{Binding LowValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                    <telerik:RadNumericUpDown Grid.Column="3" HorizontalAlignment="Stretch" VerticalAlignment="Center"  Margin="2" IsInteger="True"
                             Value="{Binding HighValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
                </Grid>
            </DataTemplate>
    Appreciate any advice,

    Thanks 
    Yuval
  2. Kiril Vandov
    Admin
    Kiril Vandov avatar
    324 posts

    Posted 20 Mar 2013 Link to this post

    Hello Yuval,

    It seems we have a bug with the SelectionEnd property in data bound scenario when used in a DataTemplate of an ItemsControl. I created a PITS item for it and you can track its progress here, I also updated your Telerik point. As a work-around you could implement a Selection property (of type SelectionRange<double>) in your ViewModel and bind directly to the Selection property of the RadSlider.

    Please accept our apologies for the inconvenience caused.

    Kind regards,
    Kiril Vandov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top