1

我正在为 Windows 11 开发一个 WinUI 3 UWP 应用程序,该应用程序自动默认为 Windows 选择的主题。有没有办法让用户选择?

4

1 回答 1

2

这是您可以更改整个应用程序的主题的方法:

if (Window.Current.Content is FrameworkElement rootElement)
{
    rootElement.RequestedTheme = ElementTheme.Light; //.Dark, .Default
}
于 2022-01-09T17:33:43.990 回答