共用方式為


TextBox.ContextMenuOpening 事件

定義

發生于系統處理顯示操作功能表的互動時。

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" />

事件類型

備註

若要覆寫或新增命令至操作功能表,您可以處理 CoNtextMenuOpening 事件,並將預設功能表取代為自訂功能表。 如需此範例,請參閱 自訂 RichEditBox 的 CommandBarFlyout -WinUI 2 資源庫中新增 'Share' 範例。 如需設計資訊,請參閱 操作功能表的指導方針

適用於

另請參閱