add:新设置
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
// 更新按钮
|
||||
|
||||
@@ -492,9 +492,6 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置选项按钮状态
|
||||
/// </summary>
|
||||
private void SetOptionButtonState(string group, int selectedIndex)
|
||||
{
|
||||
var buttons = new Dictionary<string, string[]>
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user