Files
BeWoPlaner/BeWo/Converter/BooleanOrVisibilityMultiConverter.cs

35 lines
953 B
C#

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;
namespace BeWo.Converter
{
/// <summary>
/// https://stackoverflow.com/a/19210037
/// </summary>
public class BooleanOrVisibilityMultiConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
foreach (object value in values)
{
if ((value is bool) && (bool)value == true)
{
return Visibility.Visible;
}
}
return Visibility.Collapsed;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}