44 lines
1.0 KiB
C#
44 lines
1.0 KiB
C#
// This Source Code Form is subject to the terms of the MIT License.
|
|
// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
|
|
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
|
|
// All Rights Reserved.
|
|
|
|
|
|
|
|
using WPFluent.Appearance;
|
|
|
|
namespace WPFluent.Gallery.Helpers;
|
|
|
|
internal sealed class ThemeToIndexConverter : IValueConverter
|
|
{
|
|
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is ApplicationTheme.Dark)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if (value is ApplicationTheme.HighContrast)
|
|
{
|
|
return 2;
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
{
|
|
if (value is 1)
|
|
{
|
|
return ApplicationTheme.Dark;
|
|
}
|
|
|
|
if (value is 2)
|
|
{
|
|
return ApplicationTheme.HighContrast;
|
|
}
|
|
|
|
return ApplicationTheme.Light;
|
|
}
|
|
}
|