diff --git a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
index 599db7a..8a24382 100644
--- a/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
+++ b/NotificationFlyout.Sample/NotificationFlyoutPresenter.xaml
@@ -3,14 +3,22 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:NotificationFlyout.Uwp.UI.Controls">
-
-
+
System
Dark
Light
-
+
+
+
+
+
+
diff --git a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
index 205462e..f76d082 100644
--- a/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
+++ b/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutXamlHost.cs
@@ -96,7 +96,7 @@ namespace NotificationFlyout.Wpf.UI.Controls
UpdateWindow();
UpdateIcon();
-
+ this.Hidden();
}
private void OnTaskbarChanged(object sender, EventArgs args)
diff --git a/NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs b/NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs
index 3f22693..c1a04a1 100644
--- a/NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs
+++ b/NotificationFlyout.Wpf.UI/Extensions/WindowExtensions.cs
@@ -7,6 +7,8 @@ namespace NotificationFlyout.Wpf.UI.Extensions
{
public static class WindowExtensions
{
+ private const int GWL_EX_STYLE = -20;
+
[Flags]
private enum WindowFlag : uint
{
@@ -15,17 +17,9 @@ namespace NotificationFlyout.Wpf.UI.Extensions
SWP_NOZORDER = 0x0004,
SWP_NOACTIVATE = 0x0010,
WS_EX_NOACTIVATE = 0x08000000,
- SWP_SHOWWINDOW = 0x0040
- }
-
- public static void SetWindowPosition(this Window window, double top, double left, double height, double width)
- {
- PInvoke.SetWindowPos((HWND)window.GetHandle(), (HWND)IntPtr.Zero, (int)left, (int)top, (int)width, (int)height, (uint)WindowFlag.SWP_NOSIZE | (uint)WindowFlag.SWP_NOZORDER | (uint)WindowFlag.SWP_NOACTIVATE);
- }
-
- 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);
+ SWP_SHOWWINDOW = 0x0040,
+ WS_EX_APPWINDOW = 0x00040000,
+ WS_EX_TOOLWINDOW = 0x00000080
}
public static IntPtr GetHandle(this Window window)
@@ -33,5 +27,21 @@ namespace NotificationFlyout.Wpf.UI.Extensions
var helper = new WindowInteropHelper(window);
return helper.Handle;
}
+
+ public static void Hidden(this Window window)
+ {
+ var handle = window.GetHandle();
+ PInvoke.SetWindowLong((HWND)handle, GWL_EX_STYLE, (PInvoke.GetWindowLong((HWND)handle, GWL_EX_STYLE) | (int)WindowFlag.WS_EX_TOOLWINDOW) & ~(int)WindowFlag.WS_EX_APPWINDOW);
+ }
+
+ 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);
+ }
+
+ public static void SetWindowPosition(this Window window, double top, double left, double height, double width)
+ {
+ PInvoke.SetWindowPos((HWND)window.GetHandle(), (HWND)IntPtr.Zero, (int)left, (int)top, (int)width, (int)height, (uint)WindowFlag.SWP_NOSIZE | (uint)WindowFlag.SWP_NOZORDER | (uint)WindowFlag.SWP_NOACTIVATE);
+ }
}
}
diff --git a/NotificationFlyout.Wpf.UI/NativeMethods.txt b/NotificationFlyout.Wpf.UI/NativeMethods.txt
index c243fa0..d1279bd 100644
--- a/NotificationFlyout.Wpf.UI/NativeMethods.txt
+++ b/NotificationFlyout.Wpf.UI/NativeMethods.txt
@@ -8,4 +8,6 @@ MonitorFromWindow
RegisterWindowMessage
FindWindow
SHAppBarMessage
-SetWindowPos
\ No newline at end of file
+SetWindowPos
+GetWindowLong
+SetWindowLong
\ No newline at end of file