PropertyGridControl.MenuOpening Event
Occurs when a user opens a property grid menu and allows you to customize this menu.
Namespace: DevExpress.Xpf.PropertyGrid
Assembly: DevExpress.Xpf.PropertyGrid.v24.2.dll
NuGet Package: DevExpress.Wpf.PropertyGrid
Declaration
Event Data
The MenuOpening event's data class is PropertyGridMenuEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
Customizations | Gets a collection of menu customizations applied in this event handler. |
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 RoutedEventArgs. |
Items | Gets items displayed in the invoked menu. |
Menu | Gets the invoked menu. |
MenuType | Gets the invoked menu’s type. |
OriginalSource | Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs. |
RoutedEvent | Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs. |
Row | Gets a property grid row. Inherited from PropertyGridRowBaseEventArgs. |
Source | Gets the PropertyGridControl that raised the event. |
TargetElement | Gets the UI element for which the menu is shown. |
Value | Gets a row’s value. Inherited from PropertyGridRowBaseEventArgs. |
The event data class exposes the following methods:
Method | Description |
---|---|
InvokeEventHandler(Delegate, Object) | 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 RoutedEventArgs. |
OnSetSource(Object) | 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 RoutedEventArgs. |
Remarks
The following example adds tooltips to items displayed in the Issues collection’s new item menu:
<dxprg:PropertyGridControl x:Name="propertyGrid" ShowCategories="Hidden" MenuOpening="OnMenuOpening"/>
using DevExpress.Xpf.Core;
using DevExpress.Xpf.PropertyGrid;
// ...
private void OnMenuOpening(object sender, PropertyGridMenuEventArgs e) {
if (e.MenuType == PropertyGridMenuType.NewItem && e.Row.Path == "Issues") {
e.Items[0].ToolTip = "Create a new breaking change.";
e.Items[1].ToolTip = "Report a new bug.";
e.Items[2].ToolTip = "Ask a new question.";
}
}
See Also