【问题标题】:How do I force the light theme for a MAUI Windows application?如何为 MAUI Windows 应用程序强制使用浅色主题?
【发布时间】:2021-12-29 11:17:16
【问题描述】:

我想为 MAUI Windows 应用强制设置主题,例如用于屏幕截图。 ShellApplication 元素不支持可用于 WinUI 的 RequestedTheme 属性。

【问题讨论】:

    标签: xaml themes maui


    【解决方案1】:

    您可以通过在项目的 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>
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-11
      • 2013-08-15
      相关资源
      最近更新 更多