RichEditControl.MenuCustomizations Property
Allows you to customize a menu by adding new items or removing existing ones. This is a dependency property.
Namespace: DevExpress.Xpf.RichEdit
Assembly: DevExpress.Xpf.RichEdit.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
ObservableCollection<RichEditMenuCustomization> | A collection of RichEditMenuCustomization objects. |
Example
This example demonstrates how to use the RichEditMenuCustomization.Customizations property to add custom items to the popup menu of the RichEditControl or remove the existing ones. Use the RichEditMenuCustomization.MenuType property to determine the visual element for which the popup menu is invoked.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-customize-the-popup-menu-of-the-wpf-richedit-control-t537265.
<dx:DXWindow.Resources>
<dxre:RichEditUICommand x:Key="commands" />
</dx:DXWindow.Resources>
<dxb:BarManager x:Name="barManager1" ToolbarGlyphSize="Small">
<dxb:BarManager.Items>
<dxb:BarButtonItem
x:Name="customSymbol"
Command="{Binding InsertSymbol, Mode=OneTime, Source={StaticResource commands}}"
Content="Insert Symbol" />
<dxb:BarButtonItem
x:Name="customInsertTable"
Command="{Binding InsertTable, Mode=OneTime, Source={StaticResource commands}}"
Content="Insert Table" />
<dxb:BarButtonItem
x:Name="customShowTableGrid"
Command="{Binding TableToggleShowGridlines, Mode=OneTime, Source={StaticResource commands}}"
Content="Show Gridlines" />
<dxb:BarButtonItem
x:Name="customSetAllBorders"
Command="{Binding TableToggleAllBorders, Mode=OneTime, Source={StaticResource commands}}"
Content="All Borders" />
</dxb:BarManager.Items>
<Grid>
<dxre:RichEditControl x:Name="richEdit" CommandBarStyle="Empty" BarManager="{Binding ElementName=barManager1, Mode=OneTime}" PopupMenuShowing="RichEditPopupMenuShowing">
<dxre:RichEditControl.MenuCustomizations>
<dxre:RichEditMenuCustomization>
<dxre:RemoveRichEditCommandAction Id="{x:Static dxrecore:RichEditCommandId.CutSelection}"/>
<dxb:BarButtonItemLink dxb:BarItemLinkActionBase.ItemLinkIndex="0">
<dxb:BarButtonItemLink.BarItemName>
customSymbol
</dxb:BarButtonItemLink.BarItemName>
</dxb:BarButtonItemLink>
<dxb:BarButtonItemLink dxb:BarItemLinkActionBase.ItemLinkIndex="1">
<dxb:BarButtonItemLink.BarItemName>
customInsertTable
</dxb:BarButtonItemLink.BarItemName>
</dxb:BarButtonItemLink>
<dxb:BarItemLinkSeparator dxb:BarItemLinkActionBase.ItemLinkIndex="2"></dxb:BarItemLinkSeparator>
</dxre:RichEditMenuCustomization>
<dxre:RichEditMenuCustomization MenuType="TableCell">
<dxb:BarItemLinkSeparator></dxb:BarItemLinkSeparator>
<dxb:BarButtonItemLink>
<dxb:BarButtonItemLink.BarItemName>
customShowTableGrid
</dxb:BarButtonItemLink.BarItemName>
</dxb:BarButtonItemLink>
<dxb:BarButtonItemLink>
<dxb:BarButtonItemLink.BarItemName>
customSetAllBorders
</dxb:BarButtonItemLink.BarItemName>
</dxb:BarButtonItemLink>
</dxre:RichEditMenuCustomization>
</dxre:RichEditControl.MenuCustomizations>
</dxre:RichEditControl>
</Grid>
</dxb:BarManager>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the MenuCustomizations 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.