WinUI 3 UWP - Choose appo theme

Viewed 376

I'm developing a WinUI 3 UWP app for Windows 11 and the app automatically defaults to the theme chosen by Windows. Is there any way to give the user the choice?

1 Answers

This is how you can change the theme for your whole application:

if (Window.Current.Content is FrameworkElement rootElement)
{
    rootElement.RequestedTheme = ElementTheme.Light; //.Dark, .Default
}
Related