-api-id | -api-type |
---|---|
E:Microsoft.UI.Xaml.Controls.TabView.TabCloseRequested |
winrt event |
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).
Use this event to close the requested tab by either removing it from the TabItems collection or from the collection of data items.
<TabView TabCloseRequested="Tabs_TabCloseRequested" />
// Remove the requested tab from the TabView
private void Tabs_TabCloseRequested(TabView sender, TabViewTabCloseRequestedEventArgs args)
{
sender.TabItems.Remove(args.Tab);
}