XiangTan_JiaoJie_Bak/DM_Weight/Converter/NullableToEnabelConverter.cs

28 lines
757 B
C#

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows;
namespace DM_Weight.Converter
{
public class NullableToEnabelConverter : IValueConverter
{
public bool NullValue { get; set; } = false;
public bool NotNullValue { get; set; } = true;
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value == null ? NullValue : NotNullValue;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
}