init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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 = !Array.TrueForAll(values, val => val is bool) ? false : Array.Exists(values, 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user