windowsforms-devexpress-dot-utils-dot-menu-5c076378.md
A menu item that allows you to embed an editor in a DXPopupMenu.
Namespace : DevExpress.Utils.Menu
Assembly : DevExpress.XtraEditors.v25.2.dll
NuGet Package : DevExpress.Win.Navigation
public class DXEditMenuItem :
DXMenuItem
Public Class DXEditMenuItem
Inherits DXMenuItem
Use the DXEditMenuItem.Edit property to determine the editor’s type. The DXEditMenuItem.EditValue property allows you to set the editor’s initial value. To perform custom actions after the editor’s value is changed, use the DXEditMenuItem.EditValueChanged event. Use the inherited DXSubMenuItem.Items property to add the DXEditMenuItem objects to a menu.
Note
An edit box is not visible when a DXEditMenuItem is displayed using a SkinMenuManager. To show an edit box, you need to display a DXPopupMenu object using a BarManager or RibbonControl menu manager. See the DXPopupMenu.MenuViewType topic.
The example demonstrates how to add a DateEdit item to a DXPopupMenu and display the menu as a popup toolbar.
using DevExpress.LookAndFeel;
using DevExpress.Utils.Menu;
using DevExpress.XtraEditors.Repository;
private void Form1_MouseDown(object sender, MouseEventArgs e) {
Control parentControl = this;
Point pt;
pt = e.Location;
DXPopupMenu dxPopupMenu = new DXPopupMenu();
dxPopupMenu.Items.Add(new DXEditMenuItem("dateedit", new RepositoryItemDateEdit(),
new EventHandler(OnEditValueChanged), null, null, 100, 0));
dxPopupMenu.Items.Add(new DXMenuItem("About", new EventHandler(AboutButton_Click)));
dxPopupMenu.Items.Add(new DXMenuItem("Calculate", new EventHandler(CalculateButton_Click)));
dxPopupMenu.MenuViewType = MenuViewType.Toolbar;
((IDXDropDownControl)dxPopupMenu).Show(barManager1, parentControl, pt);
}
void OnEditValueChanged(object sender, EventArgs e) {
DXEditMenuItem item = sender as DXEditMenuItem;
MessageBox.Show(item.EditValue.ToString());
}
void AboutButton_Click(object sender, EventArgs e) {
//...
}
void CalculateButton_Click(object sender, EventArgs e) {
//...
}
Imports DevExpress.Utils.Menu
Imports DevExpress.LookAndFeel
Imports DevExpress.XtraEditors.Repository
Private Sub Form1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles MyBase.MouseDown
Dim parentcontrol As Control = Me
Dim pt As Point
pt = e.Location
Dim dxPopupMenu As New DXPopupMenu
dxPopupMenu.Items.Add(New DXEditMenuItem("dateedit", New RepositoryItemDateEdit, _
AddressOf OnEditValueChanged, Nothing, Nothing, 100, 0))
dxPopupMenu.Items.Add(New DXMenuItem("About", AddressOf AboutButton_Click))
dxPopupMenu.Items.Add(New DXMenuItem("Close", AddressOf CalculateButton_Click))
dxPopupMenu.MenuViewType = MenuViewType.Toolbar
CType(dxPopupMenu, IDXDropDownControl).Show(BarManager1, parentcontrol, pt)
End Sub
Private Sub OnEditValueChanged(ByVal sender As System.Object, ByVal e As EventArgs)
Dim item As New DXEditMenuItem()
item = sender
MessageBox.Show(item.EditValue.ToString())
End Sub
Private Sub AboutButton_Click(ByVal sender As Object, ByVal e As EventArgs)
'...
End Sub
Private Sub CalculateButton_Click(ByVal sender As Object, ByVal e As EventArgs)
'...
End Sub
Object DXMenuItem DXEditMenuItem
See Also