共用方式為


TabView.TabCloseRequested 事件

定義

當用戶嘗試透過按兩下 x-to-close 按鈕、CTRL+F4 或滑鼠滾輪來關閉 Tab 時引發。

// Register
event_token TabCloseRequested(TypedEventHandler<TabView, TabViewTabCloseRequestedEventArgs const&> const& handler) const;

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

// Revoke with event_revoker
TabView::TabCloseRequested_revoker TabCloseRequested(auto_revoke_t, TypedEventHandler<TabView, TabViewTabCloseRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<TabView,TabViewTabCloseRequestedEventArgs> TabCloseRequested;
function onTabCloseRequested(eventArgs) { /* Your code */ }
tabView.addEventListener("tabcloserequested", onTabCloseRequested);
tabView.removeEventListener("tabcloserequested", onTabCloseRequested);
- or -
tabView.ontabcloserequested = onTabCloseRequested;
Public Custom Event TabCloseRequested As TypedEventHandler(Of TabView, TabViewTabCloseRequestedEventArgs) 

事件類型

範例

<TabView TabCloseRequested="Tabs_TabCloseRequested" />
// Remove the requested tab from the TabView
private void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
{
    sender.TabItems.Remove(args.Tab);
}

備註

使用此事件可從 TabItems 集合或從數據項的集合中移除要求索引標籤,以關閉所要求的索引標籤。

適用於