add:新设置
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user