Amend how we hide the xaml window

This commit is contained in:
Daniel Clark
2021-02-28 18:48:49 +00:00
parent b815985963
commit dd92d25d23
3 changed files with 3 additions and 15 deletions
@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Wpf.UI.XamlHost; using Microsoft.Toolkit.Wpf.UI.XamlHost;
using TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions;
using System.Windows; using System.Windows;
using System.Windows.Media; using System.Windows.Media;
using System; using System;
using TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions;
namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls
{ {
@@ -7,8 +7,6 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions
{ {
public static class WindowExtensions public static class WindowExtensions
{ {
private const int GWL_EX_STYLE = -20;
[Flags] [Flags]
private enum WindowFlag : uint private enum WindowFlag : uint
{ {
@@ -28,16 +26,6 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Extensions
return helper.Handle; 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) 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); 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);
+2 -2
View File
@@ -14,9 +14,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyo
EndProject 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}" 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 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 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution