Files
DP44/Common/DTS.CommonCore/.svn/pristine/db/dbc42f5a1708c2721a4071c94acd8ec5701f01a1.svn-base

32 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
using System;
using System.Linq;
using System.Windows;
using System.Windows.Data;
namespace DTS.Common.Converters
{
public class BooleanAndToVisibilityMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var useFalseAsVisible = parameter != null && parameter.ToString().ToUpper().Contains("FALSE");
var hideNotCollapse = parameter != null && parameter.ToString().ToUpper().Contains("HIDE");
bool value = !values.All(val => val is bool) ? false : values.All(val => (bool)val);
if (useFalseAsVisible)
{
if (!value)
return Visibility.Visible;
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
}
if (!value)
return hideNotCollapse ? Visibility.Hidden : Visibility.Collapsed;
return Visibility.Visible;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}