Skip to main content

Context Menus

  • 2 minutes to read

DXGrid for Silverlight can display four types of popup menus that enable an end-user to manage data (apply grouping and sorting, display summaries, etc.) and customize a View by showing and hiding its UI elements. All these menus can be customized. For example, you can remove existing menu items and/or add new items.

#Context Menus Overview

To obtain the context menu currently being displayed within a View, use the GridViewBase.GridMenu property.

Menu Type

Description

Availability

Image

Group Panel

This menu is shown when an end-user right-clicks within the Group Panel.

GridViewBase.IsGroupPanelMenuEnabled

GridMenuType_GroupPanel

Column

This menu is shown when an end-user right-clicks a column header.

DataViewBase.IsColumnMenuEnabled

GridMenuType_Column

Row Cell

This menu is shown when an end-user right-clicks a data cell. You should manually create this menu.

For an example, see How to: Display a Popup Menu for Data Cells.

DataViewBase.IsRowCellMenuEnabled

GridMenuType_RowCel

Summary

This menu is shown when an end-user right-clicks within the Summary Panel.

DataViewBase.IsTotalSummaryMenuEnabled

GridMenuType_Summary

Fixed Summary

This menu is shown when an end-user right-clicks within the Fixed Summary Panel.

DataViewBase.IsTotalSummaryMenuEnabled

fixedsummarycontextmenu

#Customizing Context Menus

A View provides multiple properties that allow you to customize its context menus by adding new menu items or removing existing items. These properties return a BarManagerActionCollection object that provides multiple methods used to manage menu items contained within a context menu.

NOTE

This feature is not available in DXTreeList when Hierarchical Data Templates are used.

Menu Type Property
Group Panel GridViewBase.GroupPanelMenuCustomizations
Column DataViewBase.ColumnMenuCustomizations
Row Cell DataViewBase.RowCellMenuCustomizations
Summary DataViewBase.TotalSummaryMenuCustomizations
  • Default Menu Item Names

    When customizing a menu (e.g. removing or moving default items), menu items are referred to by their names. Default menu item names are listed in DefaultColumnMenuItemNames and DefaultSummaryMenuItemNames.

  • Adding and Moving Menu Items

    How to add an item to the context menu

  • Removing Menu Items

    How to remove an item from the context menu

    To dynamically customize grid menus at runtime, handle the DataViewBase.ShowGridMenu event.

NOTE

When adding a sub item(s) to a context menu, the grid control must be placed inside a BarManager.

#Examples