Udostępnij za pośrednictwem


TextBox.ContextMenuOpening Event

Definition

Occurs when the system processes an interaction that displays a context menu.

public:
 virtual event ContextMenuOpeningEventHandler ^ ContextMenuOpening;
// Register
event_token ContextMenuOpening(ContextMenuOpeningEventHandler const& handler) const;

// Revoke with event_token
void ContextMenuOpening(event_token const* cookie) const;

// Revoke with event_revoker
TextBox::ContextMenuOpening_revoker ContextMenuOpening(auto_revoke_t, ContextMenuOpeningEventHandler const& handler) const;
public event ContextMenuOpeningEventHandler ContextMenuOpening;
function onContextMenuOpening(eventArgs) { /* Your code */ }
textBox.addEventListener("contextmenuopening", onContextMenuOpening);
textBox.removeEventListener("contextmenuopening", onContextMenuOpening);
- or -
textBox.oncontextmenuopening = onContextMenuOpening;
Public Custom Event ContextMenuOpening As ContextMenuOpeningEventHandler 
<TextBox ContextMenuOpening="eventhandler" />

Event Type

Remarks

To override or add commands to the context menu, you can handle the ContextMenuOpening event and replace the default menu with a custom menu. For an example of this, see the Customizing RichEditBox's CommandBarFlyout - adding 'Share' example in the WinUI 2 Gallery. For design info, see Guidelines for context menus.

Applies to

See also