2023-03-15 19:35:53 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
|
|
|
|
{
|
|
|
|
|
|
public class NullableToVisibilityConverter : IValueConverter
|
|
|
|
|
|
{
|
|
|
|
|
|
public Visibility NullValue { get; set; } = Visibility.Collapsed;
|
|
|
|
|
|
public Visibility NotNullValue { get; set; } = Visibility.Visible;
|
|
|
|
|
|
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
2023-03-15 23:05:41 +08:00
|
|
|
|
return string.IsNullOrEmpty(value?.ToString()) ? NullValue : NotNullValue;
|
2023-03-15 19:35:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Binding.DoNothing;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|