mirror of
https://github.com/babalae/better-genshin-impact.git
synced 2026-04-03 11:05:16 +08:00
28 lines
818 B
C#
28 lines
818 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace MicaSetup.Design.Converters;
|
|
|
|
[ValueConversion(typeof(object), typeof(bool))]
|
|
public class NullToBoolConverter : SingletonConverterBase<NullToBoolConverter>
|
|
{
|
|
public static readonly DependencyProperty IsInvertedProperty = DependencyProperty.Register(
|
|
nameof(IsInverted),
|
|
typeof(bool),
|
|
typeof(NullToBoolConverter),
|
|
new PropertyMetadata(false));
|
|
|
|
public bool IsInverted
|
|
{
|
|
get { return (bool)this.GetValue(IsInvertedProperty); }
|
|
set { this.SetValue(IsInvertedProperty, value); }
|
|
}
|
|
|
|
protected override object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return value == null ^ this.IsInverted;
|
|
}
|
|
}
|