【发布时间】:2021-12-29 11:17:16
【问题描述】:
我想为 MAUI Windows 应用强制设置主题,例如用于屏幕截图。 Shell 和 Application 元素不支持可用于 WinUI 的 RequestedTheme 属性。
【问题讨论】:
我想为 MAUI Windows 应用强制设置主题,例如用于屏幕截图。 Shell 和 Application 元素不支持可用于 WinUI 的 RequestedTheme 属性。
【问题讨论】:
您可以通过在项目的 Platforms\Windows 子文件夹中的 App.xaml 中设置 RequestedTheme 属性来强制使用主题:
<maui:MauiWinUIApplication
x:Class="NetMaui.WinUI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:maui="using:Microsoft.Maui"
RequestedTheme="Light"
xmlns:local="using:NetMaui.WinUI">
</maui:MauiWinUIApplication>
【讨论】: