Skip to content

Commit

Permalink
Merge pull request #19235 from unoplatform/dev/doti/docs-themes-toolk…
Browse files Browse the repository at this point in the history
…it-update
  • Loading branch information
morning4coffe-dev authored Jan 17, 2025
2 parents ccd5461 + 704fcdf commit b50066c
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 b50066c

Please sign in to comment.