File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -444,7 +444,10 @@ private void SetRequestedTheme(ApplicationTheme requestedTheme)
444
444
445
445
internal void OnRequestedThemeChanged ( )
446
446
{
447
- ApplySystemOverlaysTheming ( ) ;
447
+ if ( InitializationComplete )
448
+ {
449
+ ApplySystemOverlaysTheming ( ) ;
450
+ }
448
451
OnResourcesChanged ( ResourceUpdateReason . ThemeResource ) ;
449
452
}
450
453
Original file line number Diff line number Diff line change @@ -199,8 +199,9 @@ internal void ApplySystemOverlaysTheming()
199
199
if ( ( int ) Android . OS . Build . VERSION . SdkInt >= 35 )
200
200
{
201
201
// In edge-to-edge experience we want to adjust the theming of status bar to match the app theme.
202
- if ( ( ContextHelper . Current is Activity activity ) &&
203
- activity . Window ? . DecorView is { FitsSystemWindows : false } decorView )
202
+ if ( ( ContextHelper . TryGetCurrent ( out var context ) ) &&
203
+ context is Activity activity &&
204
+ activity . Window ? . DecorView is { FitsSystemWindows : false } decorView )
204
205
{
205
206
var requestedTheme = Microsoft . UI . Xaml . Application . Current . RequestedTheme ;
206
207
You can’t perform that action at this time.
0 commit comments