0
votes

How can I define different ContextMenus for each column in the DataGrid (Microsoft's grid)? I found out that the grid provides a ContextMenu attribute, but i want different context menu items for the columns, not the same ContextMenu for the whole grid.

Edit: Thanks for your answer! I tried to listen to the ContextMenuOpeningEvent as you suggested which was a first success: the ContextMenu can be modified in the EventHandler. But it raises another (hopefully small) problem - I now have to identify the column the mouse cursor was over when the ContextMenuOpeningEvent was triggered. I'm going to research how to do (or work around) that later.

1

1 Answers

1
votes

I haven't played with it at all, so this might be wrong, but you may be able to override the ContextMenuOpening event and create the appropriate menu on the fly.

add menu item to default context menu might give you a starting point.

Good luck.