Files
aistudio-wpf-diagram/AIStudio.Wpf.DiagramDesigner/Converters/NullOrEmptyToBoolConverter.cs
2023-01-29 22:54:06 +08:00

34 lines
977 B
C#

using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace AIStudio.Wpf.DiagramDesigner
{
public class NullOrEmptyToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty(value?.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
public class NotNullOrEmptyToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return !string.IsNullOrEmpty(value?.ToString());
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Binding.DoNothing;
}
}
}