示例#1
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var window = System.Windows.Window.GetWindow(this);

            if (window is null)
            {
                return;
            }

            var me    = (ListBox)sender;
            var theme = me.SelectedIndex switch
            {
                0 => Theme.Light,
                1 => Theme.Dark,
                2 => new()
                {
                    Active           = Color.FromRgb(0x00, 0xFF, 0x00),
                    Inactive         = Color.FromRgb(0xFF, 0x00, 0x00),
                    Background       = Color.FromRgb(0x00, 0x00, 0x00),
                    AccentForeground = Color.FromRgb(0x00, 0x00, 0x00),
                    AccentBackground = Color.FromRgb(0xFF, 0xFF, 0x00)
                },
                3 => new()
                {
                    Active           = Color.FromRgb(0x00, 0xFF, 0xFF),
                    Inactive         = Color.FromRgb(0x00, 0x7F, 0x7F),
                    Background       = Color.FromRgb(0x00, 0x00, 0x00),
                    AccentForeground = Color.FromRgb(0x00, 0x00, 0x00),
                    AccentBackground = Color.FromRgb(0x00, 0xFF, 0xFF)
                },
                _ => null
            };

            if (theme is not null)
            {
                Theming.SetTheme(window, theme);
            }
        }