Пример #1
0
        private void appearaceComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ResourceDictionary dict = new ResourceDictionary();

            if (appearaceComboBox.SelectedIndex == 0)
            {
                dict.Source = new Uri("Resources/LightColor.xaml", UriKind.Relative);
            }
            else
            {
                dict.Source = new Uri("Resources/DarkColor.xaml", UriKind.Relative);
            }
            Application.Current.Resources.Clear();
            Application.Current.Resources.MergedDictionaries.Add(dict);

            AppearanceChanged?.Invoke(appearaceComboBox.SelectedIndex == 0 ? Appearance.Light : Appearance.Dark);
        }
Пример #2
0
 protected virtual void OnAppearanceChanged(EventArgs e)
 {
     AppearanceChanged?.Invoke(this, e);
 }