GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : CellContextMenuStripNeeded Event |
<SRCategoryAttribute("Behavior")> <SRDescriptionAttribute("Occurs when a cell's shortcut menu is needed.")> Public Event CellContextMenuStripNeeded As EventHandler(Of CellContextMenuStripNeededEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of CellContextMenuStripNeededEventArgs) AddHandler instance.CellContextMenuStripNeeded, handler
[SRCategory("Behavior")] [SRDescription("Occurs when a cell's shortcut menu is needed.")] public event EventHandler<CellContextMenuStripNeededEventArgs> CellContextMenuStripNeeded
The event handler receives an argument of type CellContextMenuStripNeededEventArgs containing data related to this event. The following CellContextMenuStripNeededEventArgs properties provide information specific to this event.
Property | Description |
---|---|
CellIndex | Gets the cell index in its parent Section. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
CellName | Gets the cell name. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
ContextMenuStrip | Gets or sets the shortcut menu for the cell that raised the GcMultiRow.CellContextMenuStripNeeded event. |
RowIndex | Gets the index of the owner Row that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
Scope | Gets the area of the cell that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
SectionIndex | Gets the index of the owner Section that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellEventArgs) |
This event only can be raised when the VirtualMode property is true or the DataSource property is not a null reference (Nothing in Visual Basic).
When you handle the CellContextMenuStripNeeded event, the shortcut menu that you specify in the handler is shown whenever the user right-clicks a cell. This is useful when you want to display a shortcut menu determined by the current state or value of a cell.
The CellContextMenuStripNeeded event also occurs when the value of the Cell.ContextMenuStrip property is retrieved, either programmatically or when the user right-clicks a cell.
You can use the CellEventArgs.CellIndex and CellEventArgs.RowIndex properties to determine the state or value of a cell, and use this information to change or modify the CellContextMenuStripNeededEventArgs.ContextMenuStrip property. This property is initialized with the value of the cell's Cell.ContextMenuStrip property, which the event value overrides.
Handle the CellContextMenuStripNeeded event when working with large amounts of data to avoid the performance penalties of setting the cell's Cell.ContextMenuStrip value for multiple cells.
You can also specify shortcut menus for individual sections rather than individual cells by setting the section's Section.ContextMenuStrip property or by handling the SectionContextMenuStripNeeded event. The cell's Cell.ContextMenuStrip property setting overrides the section's Section.ContextMenuStrip property setting, and the CellContextMenuStripNeeded event overrides both the SectionContextMenuStripNeeded event and the section's Section.ContextMenuStrip property setting. You can specify a a null reference (Nothing in Visual Basic) for a cell shortcut menu to prevent a section shortcut menu from being overridden.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2