This commit is contained in:
GG Z
2025-07-31 20:12:24 +08:00
parent 4f6cd2137c
commit f209e7d3ad
426 changed files with 15854 additions and 6612 deletions

View File

@@ -0,0 +1,32 @@
using System.Windows.Markup;
namespace AntDesignWPF.Appearance;
/// <summary>
/// 提供一个字典实现,其中包含组件和其他设备使用的主题资源。
/// </summary>
[Localizability(LocalizationCategory.Ignore)]
[Ambient]
[UsableDuringInitialization(true)]
public class ThemesDictionary : ResourceDictionary
{
public ThemesDictionary() { SetSourceBasedOnSelectedTheme(ThemeMode.Light); }
private void SetSourceBasedOnSelectedTheme(ThemeMode? selectedApplicationTheme)
{
var themeName = selectedApplicationTheme switch
{
ThemeMode.Light => "Light",
ThemeMode.Dark => "Dark",
_ => "Light",
};
Source = new Uri($"{ThemeManager.ThemesDictionaryPath}{themeName}.xaml", UriKind.Absolute);
}
/// <summary>
/// 设置默认应用程序主题。
/// </summary>
public ThemeMode Theme { set => SetSourceBasedOnSelectedTheme(value); }
}