A newer version of this page is available. Switch to the current version.

SchedulerPopupMenu.GetPopupMenuById(SchedulerMenuItemId) Method

Gets a popup menu (menu item which contains a submenu) by its ID value.

Namespace: DevExpress.XtraScheduler

Assembly: DevExpress.XtraScheduler.v18.2.dll

Declaration

public SchedulerPopupMenu GetPopupMenuById(
    SchedulerMenuItemId id
)
Public Function GetPopupMenuById(
    id As SchedulerMenuItemId
) As SchedulerPopupMenu

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.

Examples

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";
        }                   
    }
}
See Also