private static void UpdateTheme()
        {
            bool isSystemLightTheme = GetIsSystemLightTheme();
            var  args = new SystemThemeChangedEventArgs(isSystemLightTheme);

            SystemThemeChanged?.Invoke(null, args);
        }
Exemple #2
0
 private void OnSystemThemeChange(object sender, SystemThemeChangedEventArgs args)
 {
     FlyoutWindow.Dispatcher.Invoke(() =>
     {
         var theme = args.IsSystemLightTheme ? ModernWpf.ElementTheme.Light : ModernWpf.ElementTheme.Dark;
         ModernWpf.ThemeManager.SetRequestedTheme(FlyoutWindow, theme);
         ModernWpf.ThemeManager.SetRequestedTheme(FlyoutWindow.TrayContextMenu, theme);
         ModernWpf.ThemeManager.SetRequestedTheme(FlyoutWindow.TrayToolTip, theme);
     });
 }
Exemple #3
0
        private void OnSystemThemeChange(object sender, SystemThemeChangedEventArgs args)
        {
            _flyoutWindow.Dispatcher.Invoke(() =>
            {
                currentTheme = args.IsSystemLightTheme ? ElementTheme.Light : ElementTheme.Dark;
                ThemeManager.SetRequestedTheme(_flyoutWindow, currentTheme);
                ThemeManager.SetRequestedTheme(_flyoutWindow.TrayContextMenu, currentTheme);
                ThemeManager.SetRequestedTheme(_flyoutWindow.TrayToolTip, currentTheme);

                if (!_isThemeUpdated)
                {
                    _isThemeUpdated = true;
                }

                UpdateFlyoutBackgroundOpacity();
                UpdateTrayIcon();
            });
        }