TabView.TabCloseRequested 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.
Overloads
TabCloseRequested |
Raised when the user attempts to close a Tab via clicking the x-to-close button, CTRL+F4, or mousewheel. This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces). |
TabCloseRequested
Raised when the user attempts to close a Tab via clicking the x-to-close button, CTRL+F4, or mousewheel.
This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).
// 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;
Public Custom Event TabCloseRequested As TypedEventHandler(Of TabView, TabViewTabCloseRequestedEventArgs)
Event Type
Examples
<TabView TabCloseRequested="Tabs_TabCloseRequested" />
// Remove the requested tab from the TabView
private void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
{
sender.TabItems.Remove(args.Tab);
}
Remarks
Use this event to close the requested tab by either removing it from the TabItems collection or from the collection of data items.