2021-07-23 09:42:22 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
|
2022-12-12 22:33:17 +08:00
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Converters
|
2021-07-23 09:42:22 +08:00
|
|
|
|
{
|
|
|
|
|
|
public class BoolVisibilityConverter : IValueConverter
|
|
|
|
|
|
{
|
|
|
|
|
|
#region IValueConverter Members
|
|
|
|
|
|
|
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
var visibility = value as bool?;
|
|
|
|
|
|
var visible = parameter as string;
|
|
|
|
|
|
|
|
|
|
|
|
if (visibility != null && visible != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (visibility == true && visible == "true")
|
|
|
|
|
|
{
|
|
|
|
|
|
return Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (visibility == false && visible == "false")
|
|
|
|
|
|
{
|
|
|
|
|
|
return Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (visibility != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (visibility == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Visibility.Visible;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
|
{
|
|
|
|
|
|
return DependencyProperty.UnsetValue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|