Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在为 Windows 11 开发一个 WinUI 3 UWP 应用程序,该应用程序自动默认为 Windows 选择的主题。有没有办法让用户选择?
这是您可以更改整个应用程序的主题的方法:
if (Window.Current.Content is FrameworkElement rootElement) { rootElement.RequestedTheme = ElementTheme.Light; //.Dark, .Default }