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

2 posts, 0 answers
  1. Judy
    Judy avatar
    2 posts
    Member since:
    Dec 2011

    Posted 18 Dec 2011 Link to this post

    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~

  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 20 Dec 2011 Link to this post

    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 >>

  3. DevCraft banner
Back to Top