SelectedIndex not working correct

2 posts, 0 answers
  1. Kirk
    Kirk avatar
    28 posts
    Member since:
    Jun 2012

    Posted 14 Jun 2012 Link to this post

    I recently started having issues with the RadListBox SelectedIndex property. It seems like you can set it once but after that it will not update. I am not 100% sure but it seemed to happen after updating to Q2 2012. I have created a simple test project with the code below. The SelectedIndex will update on the first click of the button but if you change to another item in the list it will not work again.

    <UserControl x:Class="ListBoxTest.MainPage"
        mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
     
        <Grid x:Name="LayoutRoot" Background="White">
            <telerik:RadListBox HorizontalAlignment="Left" Margin="12,12,0,0" Name="radListBox1" VerticalAlignment="Top" Width="250">
                <telerik:RadListBoxItem Content="Item 1" />
                <telerik:RadListBoxItem Content="Item 2" />
                <telerik:RadListBoxItem Content="Item 3" />
            </telerik:RadListBox>
            <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="187,88,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        </Grid>
    </UserControl>


    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
     
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            radListBox1.SelectedIndex = 1;
        }
    }
  2. Georgi
    Admin
    Georgi avatar
    348 posts

    Posted 15 Jun 2012 Link to this post

    Hello Kirk,

    We were able to reproduce the issue and we have logged it in our Public Issue Tracking System. Here you can vote and track the progress of fixing it. Nevertheless as a workaround you can use radListBox1.SelectedItems.Clear() method, a simple implementation you can find in the attached project.
    Your Telerik points have been updated for the report.

    Greetings,
    Georgi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top