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

How to avoid a selectionchanged event when i bind data source to a combobox

1 Answer 138 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Judy
Top achievements
Rank 1
Judy asked on 18 Dec 2011, 09:02 PM
Dear all:


how could i avoid a  selectionchanged event when i bind data source to a combobox?
ex:
void getVersionCompleted(...)
{
....
combobox1.ItemsSource = e.result;
//then it will call combobox1.selectionchanged event but i don't want
}

i try add combobox1.items.clear() before "combobox1.ItemsSource = e.result;"
but got a error message: System.InvalidOperationException was unhandled by user code
please kindly help...

thanks~

1 Answer, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 20 Dec 2011, 12:28 PM
Hello Judy,

If RadComboBox has set the SelectedValue property before you set ItemsSource it will try to select the item with the specified value. If you don't have set SelectedValue you should not get SelectionChanged event.

In other words the SelectionChanged event is raised every time one of the SelectedValue or SelectedItem properties change.

Best wishes,
Valeri Hristov
the Telerik team

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

Tags
ComboBox
Asked by
Judy
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Share this question
or