From fa7caf35929fe34686fcc0591193c07103e67c97 Mon Sep 17 00:00:00 2001 From: CJKmkp <2564608840@qq.com> Date: Sat, 7 Feb 2026 14:02:26 +0800 Subject: [PATCH] =?UTF-8?q?add:=E6=96=B0=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SettingsViews/AdvancedPanel.xaml.cs | 24 ++++++++---- .../SettingsViews/CanvasAndInkPanel.xaml.cs | 22 ++++++++--- .../SettingsViews/GesturesPanel.xaml.cs | 22 ++++++++--- .../SettingsViews/LuckyRandomPanel.xaml.cs | 22 ++++++++--- .../SettingsViews/PowerPointPanel.xaml.cs | 22 ++++++++--- .../SettingsViews/SettingsPanelBase.cs | 7 +++- .../SettingsViews/StartupPanel.xaml.cs | 38 ++----------------- .../SettingsViews/ThemePanel.xaml.cs | 24 +++++++----- 8 files changed, 104 insertions(+), 77 deletions(-) diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml.cs index 7397a301..6f0862bd 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/AdvancedPanel.xaml.cs @@ -200,7 +200,10 @@ namespace Ink_Canvas.Windows.SettingsViews var button = this.FindDescendantByName($"{group}{buttonName}Border") as Border; if (button != null) { - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = button.Parent as Panel; if (parent != null) { @@ -211,23 +214,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var currentTextBlock = button.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -450,7 +454,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -461,23 +468,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } if (MainWindow.Settings.Advanced == null) return; diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/CanvasAndInkPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/CanvasAndInkPanel.xaml.cs index e157cab5..a8b57c8f 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/CanvasAndInkPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/CanvasAndInkPanel.xaml.cs @@ -203,6 +203,10 @@ namespace Ink_Canvas.Windows.SettingsViews string[] buttonNames = group == "EraserSize" ? buttons : hyperbolaButtons; + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + for (int i = 0; i < buttonNames.Length && i <= selectedIndex; i++) { var button = this.FindDescendantByName($"{group}{buttonNames[i]}") as Border; @@ -210,20 +214,22 @@ namespace Ink_Canvas.Windows.SettingsViews { if (i == selectedIndex) { - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Bold; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } else { - button.Background = new SolidColorBrush(Colors.Transparent); + button.Background = unselectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -468,7 +474,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -479,23 +488,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } var canvas = MainWindow.Settings.Canvas; diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/GesturesPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/GesturesPanel.xaml.cs index 6edb3fbf..e2f66d79 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/GesturesPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/GesturesPanel.xaml.cs @@ -145,6 +145,10 @@ namespace Ink_Canvas.Windows.SettingsViews string[] buttonNames = buttons[group]; + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + for (int i = 0; i < buttonNames.Length; i++) { var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border; @@ -152,20 +156,22 @@ namespace Ink_Canvas.Windows.SettingsViews { if (i == selectedIndex) { - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Bold; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } else { - button.Background = new SolidColorBrush(Colors.Transparent); + button.Background = unselectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -256,7 +262,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -267,23 +276,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } switch (group) diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/LuckyRandomPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/LuckyRandomPanel.xaml.cs index c72d64b6..6dd01a90 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/LuckyRandomPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/LuckyRandomPanel.xaml.cs @@ -193,6 +193,10 @@ namespace Ink_Canvas.Windows.SettingsViews string[] buttonNames = buttons[group]; + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + for (int i = 0; i < buttonNames.Length; i++) { var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border; @@ -200,20 +204,22 @@ namespace Ink_Canvas.Windows.SettingsViews { if (i == selectedIndex) { - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Bold; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } else { - button.Background = new SolidColorBrush(Colors.Transparent); + button.Background = unselectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -324,7 +330,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -335,23 +344,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } var randSettings = MainWindow.Settings.RandSettings; diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/PowerPointPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/PowerPointPanel.xaml.cs index d9b69640..0d411bf8 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/PowerPointPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/PowerPointPanel.xaml.cs @@ -284,6 +284,10 @@ namespace Ink_Canvas.Windows.SettingsViews string[] buttonNames = buttons[group]; + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + for (int i = 0; i < buttonNames.Length; i++) { var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border; @@ -291,20 +295,22 @@ namespace Ink_Canvas.Windows.SettingsViews { if (i == selectedIndex) { - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Bold; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } else { - button.Background = new SolidColorBrush(Colors.Transparent); + button.Background = unselectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -497,7 +503,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -508,23 +517,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } var pptSettings = MainWindow.Settings.PowerPointSettings; diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/SettingsPanelBase.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/SettingsPanelBase.cs index d90075f7..f657b15e 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/SettingsPanelBase.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/SettingsPanelBase.cs @@ -247,18 +247,21 @@ namespace Ink_Canvas.Windows.SettingsViews if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } HandleOptionChange(group, value); diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/StartupPanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/StartupPanel.xaml.cs index 721de3b4..622829ff 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/StartupPanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/StartupPanel.xaml.cs @@ -440,8 +440,8 @@ namespace Ink_Canvas.Windows.SettingsViews try { bool isDarkTheme = ThemeHelper.IsDarkTheme; - var selectedBrush = isDarkTheme ? ThemeHelper.GetButtonBackgroundBrush() : new SolidColorBrush(Color.FromRgb(225, 225, 225)); - var unselectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(35, 35, 35)) : new SolidColorBrush(Colors.Transparent); + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); if (UpdateChannelReleaseBorder != null) { @@ -536,39 +536,9 @@ namespace Ink_Canvas.Windows.SettingsViews { bool isDarkTheme = ThemeHelper.IsDarkTheme; - // 更新更新通道按钮 - if (UpdateChannelReleaseBorder != null) + if (MainWindow.Settings?.Startup != null) { - UpdateChannelReleaseBorder.Background = isDarkTheme - ? ThemeHelper.GetButtonBackgroundBrush() - : new SolidColorBrush(Color.FromRgb(225, 225, 225)); - var textBlock = UpdateChannelReleaseBorder.Child as TextBlock; - if (textBlock != null) - { - textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); - } - } - if (UpdateChannelPreviewBorder != null) - { - UpdateChannelPreviewBorder.Background = isDarkTheme - ? ThemeHelper.GetButtonBackgroundBrush() - : new SolidColorBrush(Color.FromRgb(225, 225, 225)); - var textBlock = UpdateChannelPreviewBorder.Child as TextBlock; - if (textBlock != null) - { - textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); - } - } - if (UpdateChannelBetaBorder != null) - { - UpdateChannelBetaBorder.Background = isDarkTheme - ? ThemeHelper.GetButtonBackgroundBrush() - : new SolidColorBrush(Color.FromRgb(225, 225, 225)); - var textBlock = UpdateChannelBetaBorder.Child as TextBlock; - if (textBlock != null) - { - textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); - } + UpdateUpdateChannelButtons(MainWindow.Settings.Startup.UpdateChannel); } // 更新按钮 diff --git a/Ink Canvas/Windows/SettingsViews/SettingsViews/ThemePanel.xaml.cs b/Ink Canvas/Windows/SettingsViews/SettingsViews/ThemePanel.xaml.cs index 3bef42db..31145759 100644 --- a/Ink Canvas/Windows/SettingsViews/SettingsViews/ThemePanel.xaml.cs +++ b/Ink Canvas/Windows/SettingsViews/SettingsViews/ThemePanel.xaml.cs @@ -492,9 +492,6 @@ namespace Ink_Canvas.Windows.SettingsViews } } - /// - /// 设置选项按钮状态 - /// private void SetOptionButtonState(string group, int selectedIndex) { var buttons = new Dictionary @@ -509,6 +506,9 @@ namespace Ink_Canvas.Windows.SettingsViews if (!buttons.ContainsKey(group)) return; string[] buttonNames = buttons[group]; + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); for (int i = 0; i < buttonNames.Length; i++) { @@ -517,20 +517,22 @@ namespace Ink_Canvas.Windows.SettingsViews { if (i == selectedIndex) { - button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + button.Background = selectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Bold; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } else { - button.Background = new SolidColorBrush(Colors.Transparent); + button.Background = unselectedBrush; var textBlock = button.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } @@ -556,7 +558,10 @@ namespace Ink_Canvas.Windows.SettingsViews string group = parts[0]; string value = parts[1]; - // 清除同组其他按钮的选中状态 + bool isDarkTheme = ThemeHelper.IsDarkTheme; + var selectedBrush = isDarkTheme ? new SolidColorBrush(Color.FromRgb(25, 25, 25)) : new SolidColorBrush(Color.FromRgb(225, 225, 225)); + var unselectedBrush = new SolidColorBrush(Colors.Transparent); + var parent = border.Parent as Panel; if (parent != null) { @@ -567,23 +572,24 @@ namespace Ink_Canvas.Windows.SettingsViews string childTag = childBorder.Tag?.ToString(); if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_")) { - childBorder.Background = new SolidColorBrush(Colors.Transparent); + childBorder.Background = unselectedBrush; var textBlock = childBorder.Child as TextBlock; if (textBlock != null) { textBlock.FontWeight = FontWeights.Normal; + textBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } } } } } - // 设置当前按钮为选中状态 - border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225)); + border.Background = selectedBrush; var currentTextBlock = border.Child as TextBlock; if (currentTextBlock != null) { currentTextBlock.FontWeight = FontWeights.Bold; + currentTextBlock.Foreground = ThemeHelper.GetTextPrimaryBrush(); } var appearance = MainWindow.Settings.Appearance;