windowsforms-devexpress-dot-utils-dot-menu-9081cd8b.md
A regular menu item.
Namespace : DevExpress.Utils.Menu
Assembly : DevExpress.Utils.v25.2.dll
NuGet Packages : DevExpress.Utils, DevExpress.Wpf.Core
public class DXMenuItem :
ISupportCommandBinding,
IDisposable
Public Class DXMenuItem
Implements ISupportCommandBinding,
IDisposable
The following members return DXMenuItem objects:
The DXMenuItem class is a regular menu item. Clicking such a menu item invokes the event handler which is assigned to the item’s DXMenuItem.Click event.
You can add DXMenuItem to menus (DXPopupMenu and its descendants).
The following code sample creates a menu item that fixes the column to the left. This item is added to the column header’s context menu next to the Hide This Column item:
void gridView1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
if (e.MenuType == GridMenuType.Column) {
DXMenuItem item = new DXMenuItem("Fix/Unfix This Column", (s, args) => {
GridColumn column = (s as DXMenuItem).Tag as GridColumn;
if (column.Fixed == FixedStyle.Left)
column.Fixed = FixedStyle.None;
else column.Fixed = FixedStyle.Left;
});
item.Tag = e.HitInfo.Column;
int index = e.Menu.Items.IndexOf(e.Menu.Find(GridStringId.MenuColumnRemoveColumn));
e.Menu.Items.Insert(index + 1, item);
}
}
Private Sub gridView1_PopupMenuShowing(ByVal sender As Object, ByVal e As PopupMenuShowingEventArgs)
If e.MenuType = GridMenuType.Column Then
Dim item As DXMenuItem = New DXMenuItem("Fix/Unfix This Column", Function(s, args)
Dim column As GridColumn = TryCast((TryCast(s, DXMenuItem)).Tag, GridColumn)
If column.Fixed = FixedStyle.Left Then
column.Fixed = FixedStyle.None
Else
column.Fixed = FixedStyle.Left
End If
End Function)
item.Tag = e.HitInfo.Column
Dim index As Integer = e.Menu.Items.IndexOf(e.Menu.Find(GridStringId.MenuColumnRemoveColumn))
e.Menu.Items.Insert(index + 1, item)
End If
End Sub
Show 14 items
Object DXMenuItem DXEditMenuItem
See Also