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

Auto select first item

1 Answer 477 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Oct 2012, 05:39 PM
I have a RadComboBox bound to an ObservableCollection. The collection is modified and cleared pragmatically (via various user interactions).

I'm looking for a XAML friendly solution that will set the SelectedIndex to 0 when going from no items (no selection) to having items.

I've tried simply setting SelectedIndex=0 but that doesn't work. (I get no selection).

-Mike.




1 Answer, 1 is accepted

Sort by
0
Vladi
Telerik team
answered on 01 Nov 2012, 11:37 AM
Hi Mike,

Unfortunately if you change the ItemsSource of the control you will need to set the SelectedIndex in the code behind. The initially declared in the xaml SelectedIndex gets reset because it is associated with old ItemsSource.

Greetings,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or