Skip to main content
A newer version of this page is available. .

PopupMenuShowingEventArgs Class

Provides data for the VGridControlBase.PopupMenuShowing event.

Namespace: DevExpress.XtraVerticalGrid.Events

Assembly: DevExpress.XtraVerticalGrid.v18.1.dll

Declaration

public class PopupMenuShowingEventArgs :
    EventArgs

Remarks

The PopupMenuShowingEventArgs objects are automatically created, initialized and passed to the VGridControlBase.PopupMenuShowing event handlers.

Example

The following code shows how to customize a context menu for a PropertyGridControl via its VGridControlBase.PopupMenuShowing event. In the code below, an Invert menu item is added to the context menu shown for an Enabled row. When an end-user selects this item, the Enabled row’s value is toggled.

Note

Context menus in a PropertyGridControl are enabled if the OptionsMenu.EnableContextMenu property is set to true.

using DevExpress.Utils.Menu;
using DevExpress.XtraVerticalGrid;
using DevExpress.XtraVerticalGrid.Rows;

private void propertyGridControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
    PropertyGridControl pg = sender as PropertyGridControl;
    VGridHitInfo hi = pg.CalcHitInfo(pg.PointToClient(Cursor.Position));
    if (hi.Row == null || hi.Row.Properties.FieldName != "Enabled") return;            
    // Create a new menu item
    DXMenuItem item = new DXMenuItem("Invert");
    item.Click += new EventHandler(item_Click);
    item.Tag = hi.Row;
    e.Menu.Items.Add(item);
}
// The Invert item's Click event handler
void item_Click(object sender, EventArgs e) {
    BaseRow row = (sender as DXMenuItem).Tag as BaseRow;
    bool cellValue = (bool)row.Grid.GetCellValue(row, 0);
    row.Grid.SetCellValue(row, 0, !cellValue);
}

Inheritance

Object
EventArgs
PopupMenuShowingEventArgs
See Also