add:新设置
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
<Border x:Name="ThemeDarkBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_Dark" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="深色主题"/>
|
||||
</Border>
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="Theme_System" Margin="8,0,0,0">
|
||||
<Border x:Name="ThemeSystemBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="Theme_System" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="跟随系统"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
@@ -104,7 +104,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择浮动工具栏的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<Border x:Name="FloatingBarImgDefaultBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="FloatingBarImg_Default" Margin="0,0,8,8">
|
||||
<Border x:Name="FloatingBarImgDefaultBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_Default" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text=""ICC-CE"默认"/>
|
||||
</Border>
|
||||
<Border x:Name="FloatingBarImgNoShadowBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="FloatingBarImg_NoShadow" Margin="0,0,8,8">
|
||||
@@ -292,7 +292,7 @@
|
||||
<Border x:Name="QuickColorPaletteDisplayModeSingleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Single">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="单行显示(6色)"/>
|
||||
</Border>
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="8,0,0,0">
|
||||
<Border x:Name="QuickColorPaletteDisplayModeDoubleBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="QuickColorPaletteDisplayMode_Double" Margin="8,0,0,0">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="双行显示(8色)"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
@@ -304,7 +304,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" TextWrapping="Wrap" Text="选择橡皮按钮的显示方式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Margin="0,0,0,8">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8">
|
||||
<Border x:Name="EraserDisplayOptionBothBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Both" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="两个都显示"/>
|
||||
</Border>
|
||||
<Border x:Name="EraserDisplayOptionAreaBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="EraserDisplayOption_Area" Margin="0,0,8,8">
|
||||
@@ -399,7 +399,7 @@
|
||||
<Border x:Name="ChickenSoupSourceGaokaoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Gaokao" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="高考祝福语"/>
|
||||
</Border>
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8">
|
||||
<Border x:Name="ChickenSoupSourceHitokotoBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="ChickenSoupSource_Hitokoto" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="一言(Hitokoto API)"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
@@ -429,7 +429,7 @@
|
||||
<TextBlock Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" Text="选择取消收纳按钮的图标样式" HorizontalAlignment="Left"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,15,0">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8">
|
||||
<Border x:Name="UnFoldBtnImgArrowBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Arrow" Margin="0,0,8,8">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="箭头"/>
|
||||
</Border>
|
||||
<Border x:Name="UnFoldBtnImgPenBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="UnFoldBtnImg_Pen" Margin="0,0,8,8">
|
||||
|
||||
@@ -116,15 +116,21 @@
|
||||
<ControlTemplate TargetType="ComboBoxItem">
|
||||
<Border x:Name="Border"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#f5f5f5"/>
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Border" Property="Background" Value="#e1e1e1"/>
|
||||
<Setter TargetName="Border" Property="BorderBrush" Value="Transparent"/>
|
||||
<Setter TargetName="Border" Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="FontWeight" Value="Bold"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
|
||||
@@ -22,10 +22,10 @@
|
||||
TextWrapping="Wrap" Foreground="#9a9996" FontSize="11" Margin="0,3.5,0,0" HorizontalAlignment="Left" MaxWidth="450"/>
|
||||
</StackPanel>
|
||||
<WrapPanel Orientation="Horizontal" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,8,15,8">
|
||||
<Border x:Name="CrashActionSilentRestartBorder" Padding="13,7" CornerRadius="8" Background="#e1e1e1" Cursor="Hand" Tag="CrashAction_SilentRestart" Margin="0,0,8,8">
|
||||
<Border x:Name="CrashActionSilentRestartBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="CrashAction_SilentRestart" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" FontWeight="Bold" Text="静默重启软件"/>
|
||||
</Border>
|
||||
<Border x:Name="CrashActionNoActionBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="CrashAction_NoAction" Margin="0,0,8,8">
|
||||
<Border x:Name="CrashActionNoActionBorder" Padding="13,7" CornerRadius="8" Cursor="Hand" Tag="CrashAction_NoAction" Margin="0,0,8,8" MouseLeftButtonDown="OptionButton_Click">
|
||||
<TextBlock Foreground="#2e3436" FontSize="14" Text="无操作"/>
|
||||
</Border>
|
||||
</WrapPanel>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using Ink_Canvas;
|
||||
|
||||
namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
@@ -9,6 +11,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
public CrashActionPanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += CrashActionPanel_Loaded;
|
||||
}
|
||||
|
||||
private void CrashActionPanel_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadSettings();
|
||||
ApplyTheme();
|
||||
}
|
||||
|
||||
public event EventHandler<RoutedEventArgs> IsTopBarNeedShadowEffect;
|
||||
@@ -26,17 +35,73 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
IsTopBarNeedNoShadowEffect?.Invoke(this, new RoutedEventArgs());
|
||||
}
|
||||
}
|
||||
public void ApplyTheme()
|
||||
|
||||
public void LoadSettings()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
if (App.CrashAction == App.CrashActionType.SilentRestart)
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, true);
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, false);
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, true);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出�? {ex.Message}");
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 加载设置时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void OptionButton_Click(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var border = sender as Border;
|
||||
if (border != null)
|
||||
{
|
||||
string tag = border.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(tag))
|
||||
{
|
||||
// 清除同组其他按钮的选中状态
|
||||
if (tag == "CrashAction_SilentRestart")
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, true);
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, false);
|
||||
App.CrashAction = App.CrashActionType.SilentRestart;
|
||||
if (MainWindow.Settings?.Startup != null)
|
||||
{
|
||||
MainWindow.Settings.Startup.CrashAction = (int)App.CrashActionType.SilentRestart;
|
||||
}
|
||||
}
|
||||
else if (tag == "CrashAction_NoAction")
|
||||
{
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionSilentRestartBorder, false);
|
||||
ThemeHelper.SetOptionButtonSelectedState(CrashActionNoActionBorder, true);
|
||||
App.CrashAction = App.CrashActionType.NoAction;
|
||||
if (MainWindow.Settings?.Startup != null)
|
||||
{
|
||||
MainWindow.Settings.Startup.CrashAction = (int)App.CrashActionType.NoAction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyTheme()
|
||||
{
|
||||
try
|
||||
{
|
||||
ThemeHelper.ApplyThemeToControl(this);
|
||||
// 重新应用按钮状态以适配主题
|
||||
LoadSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"CrashActionPanel 应用主题时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,7 +218,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
private void SetToggleSwitchState(Border toggleSwitch, bool isOn)
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn ? new SolidColorBrush(Color.FromRgb(53, 132, 228)) : new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
toggleSwitch.Background = isOn
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
@@ -49,9 +50,9 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
public static Color ToggleSwitchOnBackground => IsDarkTheme ? Color.FromRgb(0, 122, 204) : Color.FromRgb(53, 132, 228);
|
||||
public static Color ToggleSwitchOffBackground => IsDarkTheme ? ButtonBackground : Color.FromRgb(225, 225, 225);
|
||||
public static Color OptionButtonSelectedBackground => SelectedBackground;
|
||||
public static Color OptionButtonUnselectedBackground => Colors.Transparent;
|
||||
public static Color OptionButtonUnselectedBackground => ButtonBackground;
|
||||
public static Color OptionButtonSelectedBorder => IsDarkTheme ? Color.FromRgb(100, 100, 100) : Color.FromRgb(160, 160, 160);
|
||||
public static Color OptionButtonUnselectedBorder => IsDarkTheme ? Color.FromRgb(50, 50, 50) : Color.FromRgb(220, 220, 220);
|
||||
public static Color OptionButtonUnselectedBorder => IsDarkTheme ? Color.FromRgb(90, 90, 90) : Color.FromRgb(220, 220, 220);
|
||||
public static Color TextBoxBackground => IsDarkTheme ? Color.FromRgb(43, 43, 43) : Color.FromRgb(255, 255, 255);
|
||||
public static Color TextBoxBorder => IsDarkTheme ? Color.FromRgb(62, 62, 62) : Color.FromRgb(200, 200, 200);
|
||||
public static Color ScrollBarTrack => IsDarkTheme ? Color.FromRgb(25, 25, 25) : Color.FromRgb(243, 243, 243);
|
||||
@@ -585,11 +586,12 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var border = comboBoxItem.Template.FindName("Border", comboBoxItem) as System.Windows.Controls.Border;
|
||||
if (border != null)
|
||||
{
|
||||
// 优先检查当前状态
|
||||
if (comboBoxItem.IsSelected)
|
||||
{
|
||||
border.Background = GetSelectedBackgroundBrush();
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
border.BorderThickness = new Thickness(1);
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
else if (comboBoxItem.IsMouseOver)
|
||||
{
|
||||
@@ -609,7 +611,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
else if (color.R == 245 && color.G == 245 && color.B == 245)
|
||||
{
|
||||
border.Background = GetHoverBackgroundBrush();
|
||||
// 如果当前是悬浮颜色,但 IsMouseOver 为 false,说明鼠标已离开,恢复默认
|
||||
border.Background = GetTextBoxBackgroundBrush();
|
||||
}
|
||||
else if (color.R == 225 && color.G == 225 && color.B == 225)
|
||||
{
|
||||
@@ -645,25 +648,76 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
comboBoxItem.MouseLeave += ComboBoxItem_MouseLeave;
|
||||
comboBoxItem.Selected += ComboBoxItem_Selected;
|
||||
comboBoxItem.Unselected += ComboBoxItem_Unselected;
|
||||
|
||||
var descriptor = System.ComponentModel.DependencyPropertyDescriptor.FromProperty(
|
||||
System.Windows.UIElement.IsMouseOverProperty, typeof(System.Windows.UIElement));
|
||||
if (descriptor != null)
|
||||
{
|
||||
descriptor.RemoveValueChanged(comboBoxItem, ComboBoxItem_IsMouseOverChanged);
|
||||
descriptor.AddValueChanged(comboBoxItem, ComboBoxItem_IsMouseOverChanged);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static void ComboBoxItem_IsMouseOverChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.ComboBoxItem comboBoxItem)
|
||||
{
|
||||
comboBoxItem.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
var border = comboBoxItem.Template?.FindName("Border", comboBoxItem) as System.Windows.Controls.Border;
|
||||
if (border != null)
|
||||
{
|
||||
if (comboBoxItem.IsSelected)
|
||||
{
|
||||
border.Background = GetSelectedBackgroundBrush();
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
else if (comboBoxItem.IsMouseOver)
|
||||
{
|
||||
border.Background = GetHoverBackgroundBrush();
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
border.Background = GetTextBoxBackgroundBrush();
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
}
|
||||
private static void ComboBoxItem_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
{
|
||||
if (sender is System.Windows.Controls.ComboBoxItem comboBoxItem)
|
||||
{
|
||||
// 使用 Dispatcher 确保在 XAML Trigger 之后执行
|
||||
comboBoxItem.Dispatcher.BeginInvoke(new Action(() =>
|
||||
{
|
||||
var border = comboBoxItem.Template?.FindName("Border", comboBoxItem) as System.Windows.Controls.Border;
|
||||
if (border != null)
|
||||
{
|
||||
if (!comboBoxItem.IsSelected)
|
||||
// 选中状态优先于悬浮状态
|
||||
if (comboBoxItem.IsSelected)
|
||||
{
|
||||
border.Background = GetSelectedBackgroundBrush();
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
else if (comboBoxItem.IsMouseOver)
|
||||
{
|
||||
border.Background = GetHoverBackgroundBrush();
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}), System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
}
|
||||
private static void ComboBoxItem_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
|
||||
@@ -676,8 +730,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (comboBoxItem.IsSelected)
|
||||
{
|
||||
border.Background = GetSelectedBackgroundBrush();
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
border.BorderThickness = new Thickness(1);
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -696,8 +750,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
if (border != null)
|
||||
{
|
||||
border.Background = GetSelectedBackgroundBrush();
|
||||
border.BorderBrush = GetBorderPrimaryBrush();
|
||||
border.BorderThickness = new Thickness(1);
|
||||
border.BorderBrush = new SolidColorBrush(Colors.Transparent);
|
||||
border.BorderThickness = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -767,13 +821,13 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
baseTrigger.Property == System.Windows.Controls.ComboBoxItem.IsSelectedProperty &&
|
||||
(bool)baseTrigger.Value == true)
|
||||
{
|
||||
setterBase.Value = GetBorderPrimaryBrush();
|
||||
setterBase.Value = new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
else if (setterBase.Property == System.Windows.Controls.Border.BorderThicknessProperty &&
|
||||
baseTrigger.Property == System.Windows.Controls.ComboBoxItem.IsSelectedProperty &&
|
||||
(bool)baseTrigger.Value == true)
|
||||
{
|
||||
setterBase.Value = new Thickness(1);
|
||||
setterBase.Value = new Thickness(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,8 +229,8 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
{
|
||||
if (toggleSwitch == null) return;
|
||||
toggleSwitch.Background = isOn
|
||||
? new SolidColorBrush(Color.FromRgb(53, 132, 228))
|
||||
: new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
? ThemeHelper.GetToggleSwitchOnBackgroundBrush()
|
||||
: ThemeHelper.GetToggleSwitchOffBackgroundBrush();
|
||||
var innerBorder = toggleSwitch.Child as Border;
|
||||
if (innerBorder != null)
|
||||
{
|
||||
@@ -476,23 +476,11 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
var button = this.FindDescendantByName($"{group}{buttonNames[i]}Border") as Border;
|
||||
if (button != null)
|
||||
{
|
||||
if (i == selectedIndex)
|
||||
{
|
||||
button.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
ThemeHelper.SetOptionButtonSelectedState(button, i == selectedIndex);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Bold;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button.Background = new SolidColorBrush(Colors.Transparent);
|
||||
var textBlock = button.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
textBlock.FontWeight = FontWeights.Normal;
|
||||
}
|
||||
textBlock.FontWeight = i == selectedIndex ? FontWeights.Bold : FontWeights.Normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,7 +516,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
string childTag = childBorder.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(group + "_"))
|
||||
{
|
||||
childBorder.Background = new SolidColorBrush(Colors.Transparent);
|
||||
ThemeHelper.SetOptionButtonSelectedState(childBorder, false);
|
||||
var textBlock = childBorder.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
@@ -540,7 +528,7 @@ namespace Ink_Canvas.Windows.SettingsViews
|
||||
}
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
var currentTextBlock = border.Child as TextBlock;
|
||||
if (currentTextBlock != null)
|
||||
{
|
||||
|
||||
@@ -1434,7 +1434,7 @@ namespace Ink_Canvas.Windows
|
||||
ClearOtherOptionsInGroup(border, tag);
|
||||
|
||||
// 设置当前按钮为选中状态
|
||||
border.Background = new SolidColorBrush(Color.FromRgb(225, 225, 225));
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, true);
|
||||
var textBlock = border.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
@@ -1464,7 +1464,7 @@ namespace Ink_Canvas.Windows
|
||||
string childTag = border.Tag?.ToString();
|
||||
if (!string.IsNullOrEmpty(childTag) && childTag.StartsWith(groupName + "_"))
|
||||
{
|
||||
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||
ThemeHelper.SetOptionButtonSelectedState(border, false);
|
||||
var textBlock = border.Child as TextBlock;
|
||||
if (textBlock != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user