mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 23:03:49 +02:00
27 lines
769 B
C#
27 lines
769 B
C#
using System;
|
|
using System.ComponentModel;
|
|
using ModernWpf;
|
|
|
|
namespace ModernWpfPlayground.Types
|
|
{
|
|
public enum ThemeMode
|
|
{
|
|
[Description("Light")] Light,
|
|
[Description("Dark")] Dark,
|
|
[Description("Use system setting")] UseSystemSetting
|
|
}
|
|
|
|
public static class ThemeModeExtension
|
|
{
|
|
public static ApplicationTheme? ToApplicationTheme(this ThemeMode themeMode)
|
|
{
|
|
return themeMode switch
|
|
{
|
|
ThemeMode.Light => ApplicationTheme.Light,
|
|
ThemeMode.Dark => ApplicationTheme.Dark,
|
|
ThemeMode.UseSystemSetting => default,
|
|
_ => throw new ArgumentOutOfRangeException(nameof(themeMode), themeMode, null)
|
|
};
|
|
}
|
|
}
|
|
} |