views:

439

answers:

1

I have a DataGrid (WPF Toolkit) with a custom combobox like edit template of a cell. This custom combo box have another datagrid like popup.

I have this problem:

In the window constructor I assign the event handler to the master datagrid with this statement

this.dgDoc.SelectionChanged += new SelectionChangedEventHandler(dgDoc_SelectionChanged);

the problem is that the function dgDoc_SelectionChanged fire also when I change selection on datagrid of combobox popup.

How can I avoid this behavior?

A: 

the events are bubbling up the tree and are finding a handler. bummer.

why dont you just check who the sender is and if it is the inner grid, ignore them, if it is the grid you are interested in handle them

Aran Mulholland
I try but the sender is always the master datagrid...also if the event is fired by combobox datagrid. Is strange.
LukePet
can you replicate it in a test project?
Aran Mulholland
I solve with a check on e.OriginalSource. Thanks.
LukePet