Home > OS >  How do I force the light theme for a MAUI Windows application?
How do I force the light theme for a MAUI Windows application?

Time:01-01

I would like to force the theme for a MAUI Windows app, for example for screenshot purposes. The Shell and Application Elements don't support the RequestedTheme property that can be used with WinUI.

CodePudding user response:

You can force the theme by setting the RequestedTheme property in the App.xaml in the Platforms\Windows subfolder in the project:

<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>

  • Related