diff --git a/samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj b/samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj index e891b9c..6cce158 100644 --- a/samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj +++ b/samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj @@ -17,27 +17,14 @@ + + + + + - - - ..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\bin\x64\Release\netcoreapp3.1\TheXamlGuy.NotificationFlyout.Common.dll - - - ..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\bin\x64\Release\netcoreapp3.1\TheXamlGuy.NotificationFlyout.Shared.UI.dll - - - ..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\bin\x64\Release\netcoreapp3.1\TheXamlGuy.NotificationFlyout.Uwp.UI.Controls.dll - - - ..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\bin\x64\Release\netcoreapp3.1\TheXamlGuy.NotificationFlyout.Wpf.UI.dll - - - ..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\bin\x64\Release\netcoreapp3.1\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls.dll - - - diff --git a/samples/NotificationFlyoutSample.sln b/samples/NotificationFlyoutSample.sln index a9190d8..34cc80b 100644 --- a/samples/NotificationFlyoutSample.sln +++ b/samples/NotificationFlyoutSample.sln @@ -12,7 +12,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyoutSample.Launcher", "NotificationFlyoutSample.Launcher\NotificationFlyoutSample.Launcher.csproj", "{5EDD254A-3F8E-4825-B806-5C230488E192}" EndProject -Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "NotificationFlyoutSample.Package", "NotificationFlyoutSample.Package\NotificationFlyoutSample.Package.wapproj", "{FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Common", "..\src\TheXamlGuy.NotificationFlyout.Common\TheXamlGuy.NotificationFlyout.Common.csproj", "{5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Shared.UI", "..\src\TheXamlGuy.NotificationFlyout.Shared.UI\TheXamlGuy.NotificationFlyout.Shared.UI.csproj", "{875E7116-3A9B-4CBE-B6D0-20818DB77280}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Uwp.UI.Controls", "..\src\TheXamlGuy.NotificationFlyout.Uwp.UI.Controls\TheXamlGuy.NotificationFlyout.Uwp.UI.Controls.csproj", "{0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Wpf.UI", "..\src\TheXamlGuy.NotificationFlyout.Wpf.UI\TheXamlGuy.NotificationFlyout.Wpf.UI.csproj", "{F6040CB8-83EE-47B9-8DD7-DF43CD555956}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Wpf.UI.Controls", "..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls.csproj", "{66433384-A10C-44A5-B734-400990A569F0}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -75,36 +83,106 @@ Global {5EDD254A-3F8E-4825-B806-5C230488E192}.Release|x64.Build.0 = Release|x64 {5EDD254A-3F8E-4825-B806-5C230488E192}.Release|x86.ActiveCfg = Release|Any CPU {5EDD254A-3F8E-4825-B806-5C230488E192}.Release|x86.Build.0 = Release|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM.ActiveCfg = Debug|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM.Build.0 = Debug|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM.Deploy.0 = Debug|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM64.Build.0 = Debug|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x64.ActiveCfg = Debug|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x64.Build.0 = Debug|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x64.Deploy.0 = Debug|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x86.ActiveCfg = Debug|x86 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x86.Build.0 = Debug|x86 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Debug|x86.Deploy.0 = Debug|x86 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|Any CPU.Build.0 = Release|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|Any CPU.Deploy.0 = Release|Any CPU - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM.ActiveCfg = Release|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM.Build.0 = Release|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM.Deploy.0 = Release|ARM - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM64.ActiveCfg = Release|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM64.Build.0 = Release|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|ARM64.Deploy.0 = Release|ARM64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x64.ActiveCfg = Release|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x64.Build.0 = Release|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x64.Deploy.0 = Release|x64 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x86.ActiveCfg = Release|x86 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x86.Build.0 = Release|x86 - {FAA7E8E0-032D-4C2A-BAB6-6E0EED3D5A6D}.Release|x86.Deploy.0 = Release|x86 + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|ARM.ActiveCfg = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|ARM.Build.0 = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|ARM64.Build.0 = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|x64.ActiveCfg = Debug|x64 + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|x64.Build.0 = Debug|x64 + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|x86.ActiveCfg = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Debug|x86.Build.0 = Debug|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|Any CPU.Build.0 = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|ARM.ActiveCfg = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|ARM.Build.0 = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|ARM64.ActiveCfg = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|ARM64.Build.0 = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|x64.ActiveCfg = Release|x64 + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|x64.Build.0 = Release|x64 + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|x86.ActiveCfg = Release|Any CPU + {5EE122E5-AFD9-4B03-A98D-34CBB0B3B3F0}.Release|x86.Build.0 = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|Any CPU.Build.0 = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|ARM.ActiveCfg = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|ARM.Build.0 = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|ARM64.Build.0 = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|x64.ActiveCfg = Debug|x64 + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|x64.Build.0 = Debug|x64 + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|x86.ActiveCfg = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Debug|x86.Build.0 = Debug|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|Any CPU.ActiveCfg = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|Any CPU.Build.0 = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|ARM.ActiveCfg = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|ARM.Build.0 = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|ARM64.ActiveCfg = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|ARM64.Build.0 = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|x64.ActiveCfg = Release|x64 + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|x64.Build.0 = Release|x64 + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|x86.ActiveCfg = Release|Any CPU + {875E7116-3A9B-4CBE-B6D0-20818DB77280}.Release|x86.Build.0 = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|ARM.ActiveCfg = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|ARM.Build.0 = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|ARM64.Build.0 = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|x64.ActiveCfg = Debug|x64 + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|x64.Build.0 = Debug|x64 + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|x86.ActiveCfg = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Debug|x86.Build.0 = Debug|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|Any CPU.Build.0 = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|ARM.ActiveCfg = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|ARM.Build.0 = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|ARM64.ActiveCfg = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|ARM64.Build.0 = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|x64.ActiveCfg = Release|x64 + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|x64.Build.0 = Release|x64 + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|x86.ActiveCfg = Release|Any CPU + {0C268B32-CED0-4F79-9CB0-B7AE84BE9EC8}.Release|x86.Build.0 = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|ARM.ActiveCfg = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|ARM.Build.0 = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|ARM64.Build.0 = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|x64.ActiveCfg = Debug|x64 + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|x64.Build.0 = Debug|x64 + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|x86.ActiveCfg = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Debug|x86.Build.0 = Debug|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|Any CPU.Build.0 = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|ARM.ActiveCfg = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|ARM.Build.0 = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|ARM64.ActiveCfg = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|ARM64.Build.0 = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|x64.ActiveCfg = Release|x64 + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|x64.Build.0 = Release|x64 + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|x86.ActiveCfg = Release|Any CPU + {F6040CB8-83EE-47B9-8DD7-DF43CD555956}.Release|x86.Build.0 = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|ARM.ActiveCfg = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|ARM.Build.0 = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|ARM64.Build.0 = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|x64.ActiveCfg = Debug|x64 + {66433384-A10C-44A5-B734-400990A569F0}.Debug|x64.Build.0 = Debug|x64 + {66433384-A10C-44A5-B734-400990A569F0}.Debug|x86.ActiveCfg = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Debug|x86.Build.0 = Debug|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|Any CPU.Build.0 = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|ARM.ActiveCfg = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|ARM.Build.0 = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|ARM64.ActiveCfg = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|ARM64.Build.0 = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|x64.ActiveCfg = Release|x64 + {66433384-A10C-44A5-B734-400990A569F0}.Release|x64.Build.0 = Release|x64 + {66433384-A10C-44A5-B734-400990A569F0}.Release|x86.ActiveCfg = Release|Any CPU + {66433384-A10C-44A5-B734-400990A569F0}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs index a940410..48068ff 100644 --- a/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs +++ b/src/TheXamlGuy.NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyout.cs @@ -251,7 +251,7 @@ namespace TheXamlGuy.NotificationFlyout.Uwp.UI.Controls _backgroundElement.Shadow = new ThemeShadow(); var currentTranslation = _backgroundElement.Translation; - var translation = new Vector3(currentTranslation.X, currentTranslation.Y, 16.0f); + var translation = new Vector3(currentTranslation.X, currentTranslation.Y, 32.0f); _backgroundElement.Translation = translation; } } diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs index 89803cc..3f11eef 100644 --- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs +++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutApplication.cs @@ -13,6 +13,7 @@ using System.Windows.Media; using System.Threading.Tasks; using Microsoft.Win32; using System.Windows.Threading; +using System.Threading; namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls { @@ -118,23 +119,25 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls _isDpiChanging = true; - _notificationFlyoutXamlHost.Visibility = Visibility.Visible; - - await Dispatcher.BeginInvoke(new Action(() => + await Application.Current.Dispatcher.Invoke(async () => { - VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.OldDpi); - }), DispatcherPriority.ContextIdle, null); + _notificationFlyoutXamlHost.Visibility = Visibility.Visible; + await Dispatcher.BeginInvoke(new Action(() => + { + VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.OldDpi); + }), DispatcherPriority.ContextIdle, null); - await Dispatcher.BeginInvoke(new Action(() => - { - VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.NewDpi); - }), DispatcherPriority.ContextIdle, null); + await Dispatcher.BeginInvoke(new Action(() => + { + VisualTreeHelper.SetRootDpi(_notificationFlyoutXamlHost, args.NewDpi); + }), DispatcherPriority.ContextIdle, null); - await Dispatcher.BeginInvoke(new Action(() => - { - _notificationFlyoutXamlHost.Visibility = Visibility.Hidden; - _isDpiChanging = false; - }), DispatcherPriority.ContextIdle, null); + await Dispatcher.BeginInvoke(new Action(() => + { + _notificationFlyoutXamlHost.Visibility = Visibility.Hidden; + _isDpiChanging = false; + }), DispatcherPriority.ContextIdle, null); + }); UpdateIcons(); } @@ -178,6 +181,7 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls _notificationFlyoutXamlHost.Show(); } + private void ShowContextMenu() { var dpiX = _notificationFlyoutXamlHost.DpiX(); @@ -191,16 +195,16 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls { if (Flyout == null) return; + var dpiX = _notificationFlyoutXamlHost.DpiX(); + var dpiY = _notificationFlyoutXamlHost.DpiY(); + var taskbarState = _taskbarHelper.GetCurrentState(); - _notificationFlyoutXamlHost.Left = taskbarState.Screen.Bounds.Left; - _notificationFlyoutXamlHost.Top = taskbarState.Screen.Bounds.Top; + _notificationFlyoutXamlHost.Left = taskbarState.Screen.Bounds.Left / dpiX; ; + _notificationFlyoutXamlHost.Top = 0; double horizontalOffset; double verticalOffset; - var dpiX = _notificationFlyoutXamlHost.DpiX(); - var dpiY = _notificationFlyoutXamlHost.DpiY(); - var workingAreaHeight = taskbarState.Screen.WorkingArea.Height / dpiX; var workingAreaWidth = taskbarState.Screen.WorkingArea.Width / dpiY; @@ -209,26 +213,26 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls { case TaskbarPlacement.Left: flyoutTaskBarPlacement = NotificationFlyoutTaskbarPlacement.Left; - verticalOffset = taskbarState.Rect.Bottom / dpiX; - horizontalOffset = taskbarState.Rect.Right / dpiY; + verticalOffset = taskbarState.Screen.WorkingArea.Height / dpiX; + horizontalOffset = taskbarState.Rect.Width / dpiY; break; case TaskbarPlacement.Top: flyoutTaskBarPlacement = NotificationFlyoutTaskbarPlacement.Top; - verticalOffset = taskbarState.Rect.Bottom / dpiX; - horizontalOffset = (_notificationFlyoutXamlHost.FlowDirection == FlowDirection.RightToLeft ? taskbarState.Rect.Left : taskbarState.Rect.Right) / dpiY; + verticalOffset = taskbarState.Rect.Height / dpiX; + horizontalOffset = (_notificationFlyoutXamlHost.FlowDirection == FlowDirection.RightToLeft ? 0 : taskbarState.Screen.WorkingArea.Width) / dpiY; break; case TaskbarPlacement.Right: flyoutTaskBarPlacement = NotificationFlyoutTaskbarPlacement.Right; - verticalOffset = taskbarState.Rect.Bottom / dpiX; - horizontalOffset = taskbarState.Rect.Left / dpiY; + verticalOffset = taskbarState.Screen.WorkingArea.Height / dpiX; + horizontalOffset = taskbarState.Screen.WorkingArea.Width / dpiY; break; case TaskbarPlacement.Bottom: flyoutTaskBarPlacement = NotificationFlyoutTaskbarPlacement.Bottom; - verticalOffset = taskbarState.Rect.Top / dpiX; - horizontalOffset = (_notificationFlyoutXamlHost.FlowDirection == FlowDirection.RightToLeft ? taskbarState.Rect.Left : taskbarState.Rect.Right) / dpiY; + verticalOffset = taskbarState.Screen.WorkingArea.Height / dpiX; + horizontalOffset = (_notificationFlyoutXamlHost.FlowDirection == FlowDirection.RightToLeft ? 0 : taskbarState.Screen.WorkingArea.Width) / dpiY; break; default: diff --git a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs index 86de72a..e953157 100644 --- a/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs +++ b/src/TheXamlGuy.NotificationFlyout.Wpf.UI.Controls/XamlHost/TransparentXamlHost.cs @@ -31,7 +31,7 @@ namespace TheXamlGuy.NotificationFlyout.Wpf.UI.Controls WindowStyle = WindowStyle.None; ResizeMode = ResizeMode.NoResize; AllowsTransparency = true; - Background = new SolidColorBrush(Colors.Red); + Background = new SolidColorBrush(Colors.Transparent); Height = WindowSize; Width = WindowSize; }