Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5124
SelectionChanged event with XamComboEditor in a XamTabControl
posted

This question was recently answered in a private support case, and I thought I'd share it here in the forums:

Q:  When using a XamComboEditor in a XamTabControl, why does the XamTabControl’s SelectionChanged event fire when an item in the XamComboEditor is selected?

A: 
This is caused by the internal use of ComboBox in the XamComboEditor. Both XamComboEditor and XamTabControl  derive from ItemsControl.   When the ComboBox inside XamComboEditor raises its SelectionChanged event (which is actually ItemsControl.SelectionChanged) it gets bubbled up to the XamTabControl.

You can prevent this from happening by hooking into the ItemsControl.SelectionChanged on the XamComboEditor and marking that event handled to prevent it from bubbling up. Otherwise, you can simply check if the sender object in the event handler is the one you are expecting before executing your logic.

Parents
  • 1425
    posted

    Currently using WPF 12.1 with XamComboEditor on a XamTabControl and experiencing this issue. I've handled the event in the SelectedItem Changed event on the XamComboEditor, as so:

    private void xamComboEditorReferenceLocation_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)

    {

                e.Handled = true;

    }

     

    but I still have the problem.

    Any ideas?

     

Reply Children
No Data