wpf-devexpress-dot-xpf-dot-bars-dot-barmanager-369b79f9.md
Specifies which mouse button should be clicked to display a context menu for an object within the BarManager.
This is an attached property.
Namespace : DevExpress.Xpf.Bars
Assembly : DevExpress.Xpf.Core.v25.2.dll
NuGet Package : DevExpress.Wpf.Core
See GetMenuShowMouseButton(UIElement) and SetMenuShowMouseButton(UIElement, ButtonSwitcher).
| Type | Description |
|---|---|
| ButtonSwitcher |
A ButtonSwitcher enumeration value indicating which mouse button should be clicked to display a context menu for an object within the BarManager.
|
Use the MenuShowMouseButton attached property to specify which mouse button should be clicked to display a custom context menu for any control within the BarManager. In code, you can use the BarManager.SetMenuShowMouseButton and BarManager.GetMenuShowMouseButton methods for this purpose.
The following example demonstrates how to show a text box’s context menu on clicking the left mouse button:
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
...
<TextBox x:Name="textEdit1" Text="Left-click this text box for a context menu" dxb:BarManager.MenuShowMouseButton="LeftButton" ContextMenu="{x:Null}">
BarManager.SetMenuShowMouseButton(textEdit1, ButtonSwitcher.LeftButton);
See Also
GetMenuShowMouseButton(UIElement)