FrameworkContentElement.ContextMenuOpening Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when any context menu on the element is opened.
public:
event System::Windows::Controls::ContextMenuEventHandler ^ ContextMenuOpening;
public event System.Windows.Controls.ContextMenuEventHandler ContextMenuOpening;
member this.ContextMenuOpening : System.Windows.Controls.ContextMenuEventHandler
Public Custom Event ContextMenuOpening As ContextMenuEventHandler
Event Type
Remarks
To manually open context menus, handlers of the events should mark the relevant event as handled. Otherwise, the existing value of the ContextMenu property will be used to automatically open a context menu. Marking the event handled will effectively cancel the default action, and could be an opportunity to reset the value of the ContextMenu property and then open the new ContextMenu. However, there is a timing issue you should be aware of. In order to completely replace the context menu through a ContextMenuOpening handler, the initial context menu must not be null / empty. Alternatively, you might need to handle the event and then manually open a new context menu. For details, see How to: Handle the ContextMenuOpening Event.
To use this event as an EventTrigger in a style, you must reference the underlying service event identifier:
<EventTrigger RoutedEvent="ContextMenuService.ContextMenuOpening">
<!-- storyboard here ... -->
</EventTrigger>
(This usage is required because the event implementation on FrameworkContentElement that exposes the underlying service event does not correctly map the ContextMenuOpening identifier for use in triggers).
Routed Event Information
Identifier field | ContextMenuOpeningEvent |
Routing strategy | Bubbling |
Delegate | ContextMenuEventHandler |
Applies to
See also
Povratne informacije
https://aka.ms/ContentUserFeedback.
Stiže uskoro: Tijekom 2024. postupno ćemo ukinuti servis Problemi sa servisom GitHub kao mehanizam za povratne informacije za sadržaj i zamijeniti ga novim sustavom za povratne informacije. Dodatne informacije potražite u članku:Pošaljite i pogledajte povratne informacije za