Skip to main content

PopupMenuShowingEventArgs Class

Provides data for the VGridControlBase.PopupMenuShowing event.

Namespace: DevExpress.XtraVerticalGrid.Events

Assembly: DevExpress.XtraVerticalGrid.v24.2.dll

Declaration

public class PopupMenuShowingEventArgs :
    BasePopupMenuShowingEventArgs

Remarks

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

Example

This example shows how to add a command that toggles the Enabled property to a context menu.

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

propertyGridControl1.PopupMenuShowing += propertyGridControl1_PopupMenuShowing;
private void propertyGridControl1_PopupMenuShowing(object sender, DevExpress.XtraVerticalGrid.Events.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;
    ToggleMenuItem.Tag = hi.Row;
    e.Menu.Items.Add(ToggleMenuItem);

}
DXMenuItem toggleMenuItem;
protected DXMenuItem ToggleMenuItem {
    get {
        if (toggleMenuItem == null) {
            DXMenuItem item = new DXMenuItem("Toggle");
            item.Click += item_Click;
            toggleMenuItem = item;
        }
        return toggleMenuItem;
    }
}
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

See Also