DockLayoutManager.ContextMenuCustomizations Property
A collection of modification actions to be performed on context menus for dock panels.
Namespace: DevExpress.Xpf.Docking
Assembly: DevExpress.Xpf.Docking.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
BarManagerActionCollection | A BarManagerActionCollection object that contains modification actions. |
Remarks
Dock panels support context menus, invoked by right-clicking the panel’s caption:
You can modify these menus by adding modification actions to the ContextMenuCustomizations collection. The actions are represented by objects that implement the DevExpress.Xpf.Bars.IBarManagerControllerAction interface. Some of these objects are:
- BarItem descendants - Adding this object to the ContextMenuCustomizations collection adds a link to this bar item to the menu.
- BarItemLink descendants - Adding this object adds a link to an existing bar item to the menu.
- AddBarItemAction - This action creates a new bar item to an internal bar item collection. However, no link to this item is added to the menu.
- AddBarItemLinkAction - This action adds a link to an existing bar item to the menu.
- InsertBarItemLinkAction - This action inserts a bar item link at a specific position within the menu.
For information on all the available customization actions, see Bar Actions.
Example
This example shows how to customize a panel’s context menu via customization actions.
Menu customization actions are added via the DockLayoutManager.ContextMenuCustomizations collection.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-a-panels-context-menu-via-actions-e1631.
<dxdo:DockLayoutManager.ContextMenuCustomizations>
<!--Adds a new About menu command at the top-->
<dxb:BarButtonItem Name="bAbout" CategoryName="Help" Content="About" ItemClick="bAbout_ItemClick" dxb:BarItemLinkActionBase.ItemLinkIndex="0" />
<!--Add a separator-->
<dxb:InsertBarItemLinkAction ItemLinkIndex="1">
<dxb:BarItemLinkSeparator />
</dxb:InsertBarItemLinkAction>
</dxdo:DockLayoutManager.ContextMenuCustomizations>
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the ContextMenuCustomizations property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.