There are no events
dgMainTemplate_CurrentCellChanged
,
dgMainTemplate_SelectionChanged
but there are events
System.Windows.Forms.DataGrid.CurrentCellChanged
and
System.Windows.Forms.DataGrid.SelectionChanged
. The names you've written are probably just methods used or not used as event handlers for those events. You can see what really happens to the event objects if you pay attention to the operators "+=" which adds handlers to the event's invocation lists (rarely used is also the operator "-=").
You can use both events to modify menu item status. The only simple problem is: event arguments for these events does not carry information on selection or current cell (both events use the type
System.EventHandler
). So, in the event handler, you can typecast
sender
parameter
DataGrid
and ask the instance about the current selection or cell using
System.Windows.Forms.DataGrid.CurrentCell
.
See
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagrid.aspx[
^].
—SA