NullToBoolConverter.cs
472 字节
using System.Globalization;
namespace IndustrialControl.Converters;
public class NullToBoolConverter : IValueConverter
{
public bool Invert { get; set; } = false;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> Invert ? value is null : value is not null;
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}