25 lines
746 B
C#
25 lines
746 B
C#
using System;
|
|
using System.Windows.Data;
|
|
|
|
namespace JD.WPF.Converters
|
|
{
|
|
public class NullToBooleanConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
bool inverted = false;
|
|
if (parameter is bool)
|
|
inverted = (bool)parameter;
|
|
|
|
if(inverted)
|
|
return value == null ? false : true;
|
|
else
|
|
return value == null ? true : false;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|