Skip to main content
Bar

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

BarManager.MenuShowMouseButton Attached Property

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.v24.2.dll

NuGet Package: DevExpress.Wpf.Core

#Declaration

#Returns

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.

#Remarks

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