microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.37k stars 682 forks source link

TabView TearOutTabs: The TabTearOutWindowRequested event is raised too often #10154

Open DHancock opened 1 week ago

DHancock commented 1 week ago

Describe the bug

The TabTearOutWindowRequested event is raised every time a tab header is left clicked, right clicked and even when the tab close button is right clicked.

As a result I've had to add code in the repro app below that limits the number of new windows created in the TabTearOutWindowRequested event handler.

If a tab isn't subsequently then torn out, the new window won't be used and remains hidden. To that end I've also had to add code to close it, allowing the app to shutdown.

Repro project: TearOutTabs.zip

Steps to reproduce the bug

.

Expected behavior

I think that the TabTearOutWindowRequested event should only be raised once per tear out sequence, with the new window cached by the tear out code until it's used. Or may be even only raised immediately before a tab is torn out when the tear out process starts.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.1: 1.6.240923002

Windows version

Windows 11 (22H2): Build 22621

Additional context

No response