Skip to content

Latest commit

 

History

History
37 lines (25 loc) · 1.09 KB

tabview_tabcloserequested.md

File metadata and controls

37 lines (25 loc) · 1.09 KB
-api-id -api-type
E:Microsoft.UI.Xaml.Controls.TabView.TabCloseRequested
winrt event

Microsoft.UI.Xaml.Controls.TabView.TabCloseRequested

-description

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).

-remarks

Use this event to close the requested tab by either removing it from the TabItems collection or from the collection of data items.

-see-also

-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);
}