From 138beb0b46d42ca9b990ae66b4cf743351ca78e8 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Sun, 5 Jun 2022 17:14:22 -0400 Subject: [PATCH] Update FluentTheme.cs --- src/Avalonia.Themes.Fluent/FluentTheme.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Avalonia.Themes.Fluent/FluentTheme.cs b/src/Avalonia.Themes.Fluent/FluentTheme.cs index 2a8e045c485..81601f72a10 100644 --- a/src/Avalonia.Themes.Fluent/FluentTheme.cs +++ b/src/Avalonia.Themes.Fluent/FluentTheme.cs @@ -83,6 +83,14 @@ public DensityStyle DensityStyle protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) { base.OnPropertyChanged(change); + + if (_loaded is null) + { + // If style wasn't yet loaded, no need to change children styles, + // it will be applied later in Loaded getter. + return; + } + if (change.Property == ModeProperty) { if (Mode == FluentThemeMode.Dark)