Ensure the flyout respects the given RequestedTheme... although it doesn't seem to be picking up the theme changes from Windows user settings just yet...

This commit is contained in:
Daniel Clark
2021-02-07 11:22:26 +00:00
parent f4556c8314
commit 61305ca00f
5 changed files with 37 additions and 28 deletions
@@ -81,6 +81,11 @@ namespace NotificationFlyout.Wpf.UI.Controls
}
private void OnIconPropertyChanged()
{
SetIcon();
}
private void SetIcon()
{
var shellTrayHandle = WindowHelper.GetHandle(ShellTrayHandleName);
if (shellTrayHandle == null) return;
@@ -88,8 +93,9 @@ namespace NotificationFlyout.Wpf.UI.Controls
var dpi = WindowHelper.GetDpi(shellTrayHandle);
var iconSource = SystemSettingsHelper.DefaultSystemTheme == SystemTheme.Dark ? IconSource : LightIconSource;
using var icon = iconSource.ConvertToIcon(dpi);
if (iconSource == null) return;
using var icon = iconSource.ConvertToIcon(dpi);
_xamlHost.SetNotificationIcon(icon.Handle);
}
}