整理控件库
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
// 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.
|
||||
|
||||
namespace WPFluent.Gallery.Helpers;
|
||||
|
||||
internal sealed class EnumToBooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (parameter is not string enumString)
|
||||
{
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
|
||||
}
|
||||
|
||||
if (!Enum.IsDefined(typeof(WPFluent.Appearance.ApplicationTheme), value))
|
||||
{
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterValueMustBeAnEnum");
|
||||
}
|
||||
|
||||
var enumValue = Enum.Parse(typeof(WPFluent.Appearance.ApplicationTheme), enumString);
|
||||
|
||||
return enumValue.Equals(value);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (parameter is not string enumString)
|
||||
{
|
||||
throw new ArgumentException("ExceptionEnumToBooleanConverterParameterMustBeAnEnumName");
|
||||
}
|
||||
|
||||
return Enum.Parse(typeof(WPFluent.Appearance.ApplicationTheme), enumString);
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
// 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.
|
||||
|
||||
namespace WPFluent.Gallery.Helpers;
|
||||
|
||||
internal sealed class NullToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return value is null ? Visibility.Collapsed : Visibility.Visible;
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
// 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.Controls;
|
||||
|
||||
namespace WPFluent.Gallery.Helpers;
|
||||
|
||||
internal sealed class PaneDisplayModeToIndexConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
NavigationViewPaneDisplayMode.LeftFluent => 1,
|
||||
NavigationViewPaneDisplayMode.Top => 2,
|
||||
NavigationViewPaneDisplayMode.Bottom => 3,
|
||||
_ => 0,
|
||||
};
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
1 => NavigationViewPaneDisplayMode.LeftFluent,
|
||||
2 => NavigationViewPaneDisplayMode.Top,
|
||||
3 => NavigationViewPaneDisplayMode.Bottom,
|
||||
_ => NavigationViewPaneDisplayMode.Left,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,4 @@
|
||||
// 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;
|
||||
using WPFluent.Appearance;
|
||||
|
||||
namespace WPFluent.Gallery.Helpers;
|
||||
|
||||
@@ -13,16 +6,11 @@ internal sealed class ThemeToIndexConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is ApplicationTheme.Dark)
|
||||
if (value is ThemeType.Dark)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (value is ApplicationTheme.HighContrast)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,14 +18,8 @@ internal sealed class ThemeToIndexConverter : IValueConverter
|
||||
{
|
||||
if (value is 1)
|
||||
{
|
||||
return ApplicationTheme.Dark;
|
||||
return ThemeType.Dark;
|
||||
}
|
||||
|
||||
if (value is 2)
|
||||
{
|
||||
return ApplicationTheme.HighContrast;
|
||||
}
|
||||
|
||||
return ApplicationTheme.Light;
|
||||
return ThemeType.Light;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user