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

GridPopupMenu Class

A pop-up menu displayed within a View.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v18.2.dll

Declaration

public class GridPopupMenu :
    DataControlPopupMenu

The following members return GridPopupMenu objects:

Remarks

The GridPopupMenu object represents a context menu displayed within a View.

Example

The following example demonstrates how to modify a column header in a grid’s Table View. In this sample, we illustrate how to add a button with an icon to a column header’s customization area.

For this, it is necessary to define a DataTemplate, which represents a button, and assign it to the DataViewBase.ColumnHeaderCustomizationAreaTemplate property. This template specifies a button and some of its properties. For example, it invokes the standard context menu on clicking this button (but disables invoking this menu when either the column header or the custom button within it are clicked).

private void TableView_ShowGridMenu(object sender, GridMenuEventArgs e) {
    // Check whether this event was raised for a column's context menu.
    // If not - exit and leave the menu shown.
    if (e.MenuType != GridMenuType.Column) return;

    // Check whether this event was raised for a custom button.
    // If not - exit and hide the menu.
    if ((e.TargetElement as Control).Tag == null) {
        e.Handled = true;
        return;
    }
}

private void Button_Click(object sender, RoutedEventArgs e) {
    // Show the context menu when a custom button is clicked.
    view.GridMenu.ShowPopup(sender as Button);
}

private void Button_PreviewMouseRightButtonUp(object sender, MouseButtonEventArgs e) {
    // Don't show the context menu when a custom button is right-clicked.
    e.Handled = true;
}

Implements

Inheritance

Show 16 items
Object
DispatcherObject
DependencyObject
Visual
UIElement
FrameworkElement
Popup
DevExpress.Xpf.Core.PopupBase
BarPopupBase
DevExpress.Xpf.Bars.BarPopupExpandable
PopupMenuBase
PopupMenu
DevExpress.Xpf.Bars.CustomizablePopupMenuBase
DevExpress.Xpf.Bars.GridPopupMenuBase
DevExpress.Xpf.Grid.DataControlPopupMenu
GridPopupMenu
See Also