SchedulerPopupMenu.GetPopupMenuById(SchedulerMenuItemId) Method
Gets a popup menu (menu item which contains a submenu) by its ID value.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.1.dll
NuGet Package: DevExpress.Win.Scheduler
Declaration
Parameters
Name | Type | Description |
---|---|---|
id | SchedulerMenuItemId | A SchedulerMenuItemId enumeration value which specifies the ID value of the popup menu to search. |
Returns
Type | Description |
---|---|
SchedulerPopupMenu | A SchedulerPopupMenu object whose ID is equal to the specified ID value. If a popup menu item with the specified ID isn’t found, then the null (Nothing in Visual Basic) value will be returned. |
Remarks
Use the GetPopupMenuById method to find a popup menu item with the specified ID value in the DXSubMenuItem.Items collection of this popup menu, or in any of its submenus. Note that this method finds only the first occurrence of an item with the specified ID.
Example
This example demonstrates how to customize the submenu of the SchedulerControl popup menu. In particular, this sample demonstrates how to find and rename the Label As item of the appointment popup menu and rename the first item of the corresponding submenu.
Call the SchedulerPopupMenu.GetPopupMenuById method to get a popup menu item with the specified ID value and get access to the entire submenu, which is opened with this menu item.
using DevExpress.XtraScheduler;
// ...
private void schedulerControl1_PopupMenuShowing(object sender, PopupMenuShowingEventArgs e) {
if (e.Menu.Id == SchedulerMenuItemId.AppointmentMenu) {
// Find the "Label As" item of the appointment popup menu and corresponding submenu.
SchedulerPopupMenu submenu = e.Menu.GetPopupMenuById(SchedulerMenuItemId.LabelSubMenu);
if (submenu != null) {
// Rename the item of the appointment popup menu.
submenu.Caption = "My Labels";
// Rename the first item of the submenu.
submenu.Items[0].Caption = "Label 1";
}
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the GetPopupMenuById(SchedulerMenuItemId) method.
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.