Files
ADP/UIShare/Converters/InverseBooleanConverter.cs
2026-06-05 10:57:09 +08:00

23 lines
616 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Globalization;
using System.Windows.Data;
namespace UIShare.Converters
{
public class InverseBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
// null 视为 false再取反 → true
var b = value as bool?;
return !(b ?? false);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
var b = value as bool?;
return !(b ?? false);
}
}
}