简体   繁体   中英

Set different SelectionChanged Event Handler for a DataGrid inside another DataGrid

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM