diff --git a/src/Avalonia.Base/StyledElement.cs b/src/Avalonia.Base/StyledElement.cs index 57bc8006e7..11df4e23f4 100644 --- a/src/Avalonia.Base/StyledElement.cs +++ b/src/Avalonia.Base/StyledElement.cs @@ -316,13 +316,10 @@ namespace Avalonia throw new InvalidOperationException("BeginInit was not called."); } - if (--_initCount == 0) + if (--_initCount == 0 && _logicalRoot is not null) { - if (_logicalRoot is not null) - { - ApplyStyling(); - InitializeIfNeeded(); - } + ApplyStyling(); + InitializeIfNeeded(); } }