Skip to content

Commit

Permalink
Add "Prevent showing the dummy/empty/ghost DesktopWindowXamlSource wi…
Browse files Browse the repository at this point in the history
…ndow in the task bar" workaround from Mile.Xaml.Native for Mile.Xaml.Managed.
  • Loading branch information
MouriNaruto committed Dec 31, 2023
1 parent 105faae commit 204fc82
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Mile.Xaml.Managed/XamlApplicationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ private static extern IntPtr DispatchMessage(
[ThreadStatic]
private static WindowsXamlManager XamlManager = null;

[ThreadStatic]
private static System.Windows.Forms.Form CoreWindowHostWindow = null;

public static void ThreadInitialize(
this Application BaseObject)
{
Expand All @@ -47,6 +50,22 @@ public static void ThreadInitialize(
}

BaseObject.SetTransparentBackgroundAttribute(true);

// Prevent showing the dummy/empty/ghost DesktopWindowXamlSource window
// in the task bar.
// Reference: https://github.com/microsoft/terminal/issues/6507
// Reference: https://github.com/microsoft/microsoft-ui-xaml/issues/6490
// Fixes: https://github.com/M2Team/NanaZip/issues/225
// For also fixing the window with empty content due to CoreWindow is
// not exist issue, create a host window without message loop is a
// better workaround.
if (CoreWindowHostWindow == null)
{
CoreWindowHostWindow = new System.Windows.Forms.Form();
CoreWindowHostWindow.Controls.Add(new WindowsXamlHost());
CoreWindowHostWindow.Show();
CoreWindowHostWindow.Hide();
}
}

public static void ThreadUninitialize(
Expand Down

0 comments on commit 204fc82

Please sign in to comment.