[Settings]Theme override fix and cleanup (#32362)

* theme override fix and cleanup

* test fix
This commit is contained in:
Davide Giacometti
2024-04-17 16:39:19 +02:00
committed by GitHub
parent fba5f6f002
commit b14aa8276d
9 changed files with 89 additions and 129 deletions

View File

@@ -6,10 +6,11 @@ using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.Json;
using Microsoft.UI.Xaml;
namespace Microsoft.PowerToys.Settings.UI.Helpers
{
internal sealed class Utils
internal sealed class WindowHelper
{
private static string _placementPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Microsoft\PowerToys\settings-placement.json");
@@ -45,5 +46,13 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers
{
}
}
public static void SetTheme(Window window, ElementTheme theme)
{
if (window.Content is FrameworkElement rootElement)
{
rootElement.RequestedTheme = theme;
}
}
}
}