// Create a new Window once the Tab is dragged outside. private async void Tabs_TabDroppedOutside(TabView sender, TabViewTabDroppedOutsideEventArgs args) { AppWindow newWindow = await AppWindow.TryCreateAsync(); var newPage = new TabViewWindowingSamplePage(); newPage.SetupWindow(newWindow); ElementCompositionPreview.SetAppWindowContent(newWindow, newPage); Tabs.TabItems.Remove(args.Tab); newPage.AddTabToTabs(args.Tab); await newWindow.TryShowAsync(); }
// Create a new Window once the Tab is dragged outside. private async void Tabs_TabDroppedOutside(TabView sender, TabViewTabDroppedOutsideEventArgs args) { // AppWindow was introduced in Windows 10 version 18362 (ApiContract version 8). // If the app is running on a version earlier than 18362, simply no-op. // If your app needs to support multiple windows on earlier versions of Win10, you can use CoreWindow/ApplicationView. // More information about showing multiple views can be found here: https://docs.microsoft.com/windows/uwp/design/layout/show-multiple-views if (!ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) { return; } AppWindow newWindow = await AppWindow.TryCreateAsync(); var newPage = new TabViewWindowingSamplePage(); newPage.SetupWindow(newWindow); ElementCompositionPreview.SetAppWindowContent(newWindow, newPage); Tabs.TabItems.Remove(args.Tab); newPage.AddTabToTabs(args.Tab); await newWindow.TryShowAsync(); }