|
|
@@ -7,18 +7,21 @@ public partial class ViewAView : UserControl
|
|
|
public ViewAView()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
- Loaded += (_, _) =>
|
|
|
- {
|
|
|
- if (this.FindControl<Border>("TitleBar") is Border titleBar)
|
|
|
- YZWater.Avalonia.Controls.ThemeBrushBinding.BindTitleBar(titleBar);
|
|
|
- if (this.FindControl<TextBlock>("TitleText") is TextBlock t)
|
|
|
- YZWater.Avalonia.Controls.ThemeHelper.ThemeChanged += () => t.Foreground = YZWater.Avalonia.Controls.ThemeHelper.HeaderText;
|
|
|
- if (this.FindControl<TextBlock>("SubtitleText") is TextBlock s)
|
|
|
- YZWater.Avalonia.Controls.ThemeHelper.ThemeChanged += () => s.Foreground = YZWater.Avalonia.Controls.ThemeHelper.HeaderSubtext;
|
|
|
- if (this.FindControl<Border>("StatusBar") is Border statusBar)
|
|
|
- YZWater.Avalonia.Controls.ThemeBrushBinding.BindStatusBar(statusBar);
|
|
|
- if (this.FindControl<Border>("RootBorder") is Border root)
|
|
|
- YZWater.Avalonia.Controls.ThemeBrushBinding.BindContent(root);
|
|
|
- };
|
|
|
+ Loaded += (_, _) => ApplyCurrentTheme();
|
|
|
+ YZWater.Avalonia.Controls.ThemeHelper.ThemeChanged += ApplyCurrentTheme;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ApplyCurrentTheme()
|
|
|
+ {
|
|
|
+ if (this.FindControl<Border>("TitleBar") is Border titleBar)
|
|
|
+ titleBar.Background = YZWater.Avalonia.Controls.ThemeHelper.HeaderBg;
|
|
|
+ if (this.FindControl<TextBlock>("TitleText") is TextBlock t)
|
|
|
+ t.Foreground = YZWater.Avalonia.Controls.ThemeHelper.HeaderText;
|
|
|
+ if (this.FindControl<TextBlock>("SubtitleText") is TextBlock s)
|
|
|
+ s.Foreground = YZWater.Avalonia.Controls.ThemeHelper.HeaderSubtext;
|
|
|
+ if (this.FindControl<Border>("StatusBar") is Border statusBar)
|
|
|
+ statusBar.Background = YZWater.Avalonia.Controls.ThemeHelper.NavBg;
|
|
|
+ if (this.FindControl<Border>("RootBorder") is Border root)
|
|
|
+ root.Background = YZWater.Avalonia.Controls.ThemeHelper.AppBg;
|
|
|
}
|
|
|
}
|