|
|
@@ -1,5 +1,4 @@
|
|
|
using Avalonia.Controls;
|
|
|
-using YZWater.Avalonia.Controls;
|
|
|
|
|
|
namespace YZWater.Avalonia.Views;
|
|
|
|
|
|
@@ -8,15 +7,18 @@ public partial class ViewAView : UserControl
|
|
|
public ViewAView()
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
- if (this.FindControl<Border>("TitleBar") is Border titleBar)
|
|
|
- ThemeBrushBinding.BindTitleBar(titleBar);
|
|
|
- if (this.FindControl<TextBlock>("TitleText") is TextBlock t)
|
|
|
- ThemeHelper.ThemeChanged += () => t.Foreground = ThemeHelper.HeaderText;
|
|
|
- if (this.FindControl<TextBlock>("SubtitleText") is TextBlock s)
|
|
|
- ThemeHelper.ThemeChanged += () => s.Foreground = ThemeHelper.HeaderSubtext;
|
|
|
- if (this.FindControl<Border>("StatusBar") is Border statusBar)
|
|
|
- ThemeBrushBinding.BindStatusBar(statusBar);
|
|
|
- if (this.FindControl<Border>("RootBorder") is Border root)
|
|
|
- ThemeBrushBinding.BindContent(root);
|
|
|
+ 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);
|
|
|
+ };
|
|
|
}
|
|
|
}
|