mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-14 21:26:35 +08:00
36 lines
936 B
C#
36 lines
936 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace Dragablz.Converters
|
|
{
|
|
public class BooleanAndToVisibilityConverter : IMultiValueConverter
|
|
{
|
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
if (values == null)
|
|
return Visibility.Collapsed;
|
|
|
|
return values.Select(GetBool).All(b => b)
|
|
? Visibility.Visible
|
|
: Visibility.Collapsed;
|
|
}
|
|
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
private static bool GetBool(object value)
|
|
{
|
|
if (value is bool)
|
|
{
|
|
return (bool)value;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
} |