Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toplevel - Fix system theme not being applied at launch on some platforms #16159

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/Android/Avalonia.Android/Platform/AndroidInsetsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,6 @@ public SystemBarTheme? SystemBarTheme
{
_statusBarTheme = value;

if (!_topLevel.View.IsShown)
{
return;
}

var compat = new WindowInsetsControllerCompat(Window, _topLevel.View);

if (_isDefaultSystemBarLightTheme == null)
Expand Down Expand Up @@ -229,11 +224,6 @@ public bool? IsSystemBarVisible
{
_systemUiVisibility = value;

if (!_topLevel.View.IsShown)
{
return;
}

var compat = WindowCompat.GetInsetsController(Window, _topLevel.View);

if (value == null || value.Value)
Expand Down
5 changes: 5 additions & 0 deletions src/Avalonia.Controls/TopLevel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,11 @@ public TopLevel(ITopLevelImpl impl, IAvaloniaDependencyResolver? dependencyResol
impl.TransparencyLevelChanged = HandleTransparencyLevelChanged;

CreatePlatformImplBinding(TransparencyLevelHintProperty, hint => PlatformImpl.SetTransparencyLevelHint(hint ?? Array.Empty<WindowTransparencyLevel>()));
CreatePlatformImplBinding(ActualThemeVariantProperty, variant =>
{
variant ??= ThemeVariant.Default;
PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light);
});

_keyboardNavigationHandler?.SetOwner(this);
_accessKeyHandler?.SetOwner(this);
Expand Down
5 changes: 0 additions & 5 deletions src/Avalonia.Controls/WindowBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ static WindowBase()
public WindowBase(IWindowBaseImpl impl) : this(impl, AvaloniaLocator.Current)
{
CreatePlatformImplBinding(TopmostProperty, topmost => PlatformImpl!.SetTopmost(topmost));
CreatePlatformImplBinding(ActualThemeVariantProperty, variant =>
{
variant ??= ThemeVariant.Default;
PlatformImpl?.SetFrameThemeVariant((PlatformThemeVariant?)variant ?? PlatformThemeVariant.Light);
});

FrameSize = impl.FrameSize;
}
Expand Down
Loading