using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace Szmedi.RvKits.Converters; public class InvertBooleanToVisibilityConverter : IValueConverter { /// /// 绑定的后台属性值,经过此转换器转换成前端的值 /// /// /// /// /// /// public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var isChecked = value as bool?; return isChecked is null or false ? (object)Visibility.Visible : Visibility.Collapsed; } /// /// 前端的值,经过此转换器转为后台属性值 /// /// /// /// /// /// public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }