Generic.xaml and Events

Dec 23, 2008 at 6:21 PM

I need to hook up to the ContextMenuOpening event of my DataGridColumnHeader, but I have the DataGridColumnHeader style defined in the toolkit generic.xaml which prevents me from doing this. I have been playing around with overriding OnApplyTemplate for the DataGrid but I can't get the relevant column from that event (and it is also not limited to the headers).

Can anybody suggest a way to hook up to this event?

Dec 29, 2008 at 11:27 AM
I have a working solution to this now - I have handled the ContextMenuOpening event at the DataGrid level and used the e.OriginalSource to find the DataGridColumnHeader. Seems an OK solution (other than handling unnecessary hits from the grid itself rather than just the headers) unless anyone has any other ideas.