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

SelectedIndex not working correct

1 Answer 115 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Kirk
Top achievements
Rank 1
Kirk asked on 14 Jun 2012, 07:50 PM
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;
    }
}

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 15 Jun 2012, 07:01 AM
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 >>

Tags
ListBox
Asked by
Kirk
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or