A newer version of this page is available. Switch to the current version.

VGridControlBase.PopupMenuShowing Event

Allows you to populate a context menu invoked with a right-click on a property.

Namespace: DevExpress.XtraVerticalGrid

Assembly: DevExpress.XtraVerticalGrid.v19.1.dll


public event PopupMenuShowingEventHandler PopupMenuShowing

Event Data

The PopupMenuShowing event's data class is PopupMenuShowingEventArgs. The following properties provide information specific to this event:

Property Description
Menu Gets or sets the control’s popup menu that will be shown.
Row Gets the row where the popup menu will be displayed.


If the PropertyGridControl.OptionsMenu.EnableContextMenu option is enabled (see VGridOptionsMenu.EnableContextMenu), the property grid displays a context menu with a right-click on a property.


The menu contains the predefined Reset command that sets the property to its default value. The PopupMenuShowing event allows you to populate the menu with custom commands.

DXMenuItem createDataBindingItem;
protected DXMenuItem CreateDataBindingItem {
    get {
        if (createDataBindingItem == null) {
            DXMenuItem item = new DXMenuItem("Create Data Binding...");
            item.Click += (s, ee) => MessageBox.Show("'Create Data Binding...' is clicked.");
            createDataBindingItem = item;
        return createDataBindingItem;
private void Grid_PopupMenuShowing(object sender, Events.PopupMenuShowingEventArgs e) {
    if(e.Row.Properties.FieldName == "Appearance.BackColor")


Items added using this event are also shown when the menu is invoked with a click on a brick button against a property (see PGridOptionsView.ShowRowBrick).


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;

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);
See Also