From feecb39b2869948dccc66a593ce0dab5d1b0a582 Mon Sep 17 00:00:00 2001 From: Eric Maupin Date: Thu, 10 Jan 2019 16:05:04 -0500 Subject: [Win] Drop ThemeManager --- .../MainWindow.xaml.cs | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'Xamarin.PropertyEditing.Windows.Standalone') diff --git a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs index 382c1a5..93ddf21 100644 --- a/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs +++ b/Xamarin.PropertyEditing.Windows.Standalone/MainWindow.xaml.cs @@ -26,6 +26,8 @@ namespace Xamarin.PropertyEditing.Windows.Standalone AutoExpandGroups = new[] { "ReadWrite" } }; + Application.Current.Resources.MergedDictionaries.Add (DarkTheme); + #if USE_VS_ICONS this.panel.Resources.MergedDictionaries.Add (new ResourceDictionary { Source = new Uri ("pack://application:,,,/ProppyIcons.xaml", UriKind.RelativeOrAbsolute) @@ -33,6 +35,13 @@ namespace Xamarin.PropertyEditing.Windows.Standalone #endif } + private static readonly ResourceDictionary DarkTheme = new ResourceDictionary () { + Source = new Uri ("pack://application:,,,/Xamarin.PropertyEditing.Windows;component/Themes/VS.Dark.xaml") + }; + private static readonly ResourceDictionary LightTheme = new ResourceDictionary () { + Source = new Uri ("pack://application:,,,/Xamarin.PropertyEditing.Windows;component/Themes/VS.Light.xaml") + }; + private async void Button_Click (object sender, RoutedEventArgs e) { object inspectedObject; @@ -57,15 +66,18 @@ namespace Xamarin.PropertyEditing.Windows.Standalone private void Theme_Click (object sender, RoutedEventArgs e) { if (e.Source is RadioButton rb) { - switch (rb.Content.ToString()) { + switch (rb.Content.ToString ()) { case "Dark Theme": - PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Dark; + Application.Current.Resources.MergedDictionaries.Remove (LightTheme); + Application.Current.Resources.MergedDictionaries.Add (DarkTheme); break; case "Light Theme": - PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.Light; + Application.Current.Resources.MergedDictionaries.Remove (DarkTheme); + Application.Current.Resources.MergedDictionaries.Add (LightTheme); break; default: - PropertyEditorPanel.ThemeManager.Theme = PropertyEditing.Themes.PropertyEditorTheme.None; + Application.Current.Resources.MergedDictionaries.Remove (LightTheme); + Application.Current.Resources.MergedDictionaries.Remove (DarkTheme); break; } } -- cgit v1.2.3