Skip to content

Commit

Permalink
Merge pull request #19322 from unoplatform/mergify/bp/release/stable/…
Browse files Browse the repository at this point in the history
…5.5/pr-19235

docs: Update Working with Themes (backport #19235)
  • Loading branch information
jeromelaban authored Jan 28, 2025
2 parents 87eead8 + 39f94c9 commit bfe8157
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc/articles/features/working-with-themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ public class MainPage : Page

private void OnThemeChanged(ThemeListener sender)
{
bool isDarkMode = sender.CurrentTheme == ApplicationTheme.Dark;
var theme = SystemThemeHelper.IsRootInDarkMode(this.XamlRoot) ? ElementTheme.Light : ElementTheme.Dark;

SystemThemeHelper.SetApplicationTheme(darkMode: isDarkMode);
SystemThemeHelper.SetApplicationTheme(this.XamlRoot, theme);
}
}
```
Expand All @@ -94,12 +94,14 @@ public class SettingsPage : Page

private void OnLoaded(object sender, RoutedEventArgs e)
{
this.DarkModeToggle.IsOn = SystemThemeHelper.IsDarkModeEnabled;
this.DarkModeToggle.IsOn = SystemThemeHelper.IsRootInDarkMode(this.XamlRoot);
}

private void OnDarkModeToggleToggled(object sender, RoutedEventArgs e)
{
SystemThemeHelper.SetApplicationTheme(darkMode: this.DarkModeToggle.IsOn);
var theme = DarkModeToggle.IsOn ? ElementTheme.Light : ElementTheme.Dark;

SystemThemeHelper.SetApplicationTheme(this.XamlRoot, theme);
}
}
```
Expand Down

0 comments on commit bfe8157

Please sign in to comment.