SchedulerControl.PopupMenuShowing Event
Occurs before a popup menu is created for the SchedulerControl every time a popup menu is invoked.
Namespace: DevExpress.Xpf.Scheduler
Assembly: DevExpress.Xpf.Scheduler.v24.2.dll
NuGet Package: DevExpress.Wpf.Scheduler
#Declaration
public event SchedulerMenuEventHandler PopupMenuShowing
#Event Data
The PopupMenuShowing event's data class is SchedulerMenuEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Customizations |
Provides access to a collection of customizations of the popup menu, customized via the Scheduler |
Handled |
Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route.
Inherited from Routed |
Menu |
Gets the popup menu for which the Scheduler |
Original |
Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class.
Inherited from Routed |
Routed |
Gets or sets the Routed |
Source |
Gets or sets a reference to the object that raised the event.
Inherited from Routed |
The event data class exposes the following methods:
Method | Description |
---|---|
Invoke |
When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation.
Inherited from Routed |
On |
When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes.
Inherited from Routed |
#Remarks
Important
You are viewing documentation for the legacy WPF Scheduler control. If you’re starting a new project, we strongly recommend that you use a new control declared in the DevExpress.
Handle the PopupMenuShowing event to dynamically customize the Scheduler control popup menus at runtime. For example, you can remove existing menu items and/or add new items. Use the SchedulerMenuEventArgs.Menu property to get access to the current popup menu and modify the list of menu items via the SchedulerMenuEventArgs.Customizations collection.
You can also customize the scheduler’s default, appointment and time ruler popup menus via the SchedulerControl.DefaultMenuCustomizations, SchedulerControl.AppointmentMenuCustomizations and SchedulerControl.TimeRulerMenuCustomizations properties.
Note
Use e.
#Example
This example demonstrates how to customize the SchedulerControl’s context menu at runtime by removing the New Recurring Appointment menu item from the Default Popup Menu, and adding a custom item instead.
Handle the SchedulerControl.PopupMenuShowing
event. In the event handler, use the SchedulerMenuEventArgs.Menu property to determine whether the default popup menu raised an event, and modify the SchedulerMenuEventArgs.Customizations collection to add or remove popup menu items.
<dxsch:SchedulerControl Name="schedulerControl1"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
PopupMenuShowing="schedulerControl1_PopupMenuShowing">
private void schedulerControl1_PopupMenuShowing(object sender, SchedulerMenuEventArgs e) {
// Check whether this event was raised for a default popup menu of the Scheduler control.
if (e.Menu.Name == SchedulerMenuItemName.DefaultMenu)
{
for (int i = 0; i < e.Menu.Items.Count; i++)
{
SchedulerBarItem menuItem = e.Menu.Items[i] as SchedulerBarItem;
if (menuItem != null)
{
if (menuItem != null && menuItem.Name == SchedulerMenuItemName.NewAllDayEvent)
{
menuItem.Content = "Create All-Day Appointment";
break;
}
}
}
// Remove the New Recurring Event menu item using the Action approach.
e.Customizations.Add(new RemoveBarItemAndLinkAction()
{
ItemName = SchedulerMenuItemName.NewRecurringEvent
});
// Create a custom menu item.
BarButtonItem myMenuItem = new BarButtonItem();
myMenuItem.Name = "customItem";
myMenuItem.Content = "Item Added at Runtime";
myMenuItem.ItemClick += new ItemClickEventHandler(customItem_ItemClick);
// Insert a menu separator.
e.Customizations.Add(new BarItemLinkSeparator());
// Insert a new item into the Scheduler popup menu.
e.Customizations.Add(myMenuItem);
}
}
private void customItem_ItemClick(object sender, ItemClickEventArgs e) {
// Implement a custom action.
MessageBox.Show(String.Format("{0} is clicked", e.Item.Name));
}