Files
DP44/Common/DTS.CommonCore/.svn/pristine/49/49cede4f8d0b55ef57c960f8f589e4f4342c13bd.svn-base

33 lines
1.2 KiB
Plaintext
Raw 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 BooleanOrToVisibilityMultiConverter : 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.Any(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();
}
}
}