From dd92d25d235b31502f3535dd4d8d2ec91bfc49b4 Mon Sep 17 00:00:00 2001 From: Daniel Clark Date: Sun, 28 Feb 2021 18:48:49 +0000 Subject: [PATCH] Amend how we hide the xaml window --- .../XamlHost/TransparentXamlHost.cs | 2 +- .../Extensions/WindowExtensions.cs | 12 ------------ src/TheXamlGuy.NotificationFlyout.sln | 4 ++-- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs index 3f802c1..17871d9 100644 --- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs +++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs @@ -1,8 +1,8 @@ using Microsoft.Toolkit.Wpf.UI.XamlHost; -using TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions; using System.Windows; using System.Windows.Media; using System; +using TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions; namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls { diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs index 615eded..b214524 100644 --- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs +++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs @@ -7,8 +7,6 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions { public static class WindowExtensions { - private const int GWL_EX_STYLE = -20; - [Flags] private enum WindowFlag : uint { @@ -28,16 +26,6 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions return helper.Handle; } - public static void Hidden(this Window window) - { - var handle = window.GetHandle(); - - int exStyle = (int)PInvoke.GetWindowLong((HWND)handle, (int)GWL_EX_STYLE); - - exStyle |= (int)WindowFlag.WS_EX_APPWINDOW; - PInvoke.SetWindowLong((HWND)handle, (int)GWL_EX_STYLE, exStyle); - } - public static void SetTopAll(this Window window) { PInvoke.SetWindowPos((HWND)window.GetHandle(), (HWND)new IntPtr(-1), 0, 0, 0, 0, (uint)WindowFlag.SWP_NOMOVE | (uint)WindowFlag.SWP_NOSIZE | (uint)WindowFlag.WS_EX_NOACTIVATE); diff --git a/src/TheXamlGuy.NotificationFlyout.sln b/src/TheXamlGuy.NotificationFlyout.sln index 53516e8..9acce17 100644 --- a/src/TheXamlGuy.NotificationFlyout.sln +++ b/src/TheXamlGuy.NotificationFlyout.sln @@ -14,9 +14,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Wpf.UI.Controls", "TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls.csproj", "{3205F101-E5F3-4B57-B0BB-33693F906B77}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheXamlGuy.NotificationFlyout.Shared.UI", "TheXamlGuy.NotificationFlyout.Shared.UI\TheXamlGuy.NotificationFlyout.Shared.UI.csproj", "{341F9830-BB2F-4A2F-A81A-3DBAF307B4EF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Shared.UI", "TheXamlGuy.NotificationFlyout.Shared.UI\TheXamlGuy.NotificationFlyout.Shared.UI.csproj", "{341F9830-BB2F-4A2F-A81A-3DBAF307B4EF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheXamlGuy.NotificationFlyout.Common", "TheXamlGuy.NotificationFlyout.Common\TheXamlGuy.NotificationFlyout.Common.csproj", "{4F05A3D6-DBBC-4921-97BA-6843925CD74B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Common", "TheXamlGuy.NotificationFlyout.Common\TheXamlGuy.NotificationFlyout.Common.csproj", "{4F05A3D6-DBBC-4921-97BA-6843925CD74B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution