using System; using System.Globalization; using System.Linq; using System.Windows; using System.Windows.Data; namespace Compdfkit_Tools.Common { public class AndMultiBoolValueConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values != null && values.All(v => v is bool boolValue)) { return values.Cast().All(v => v); } return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return Enumerable.Repeat(DependencyProperty.UnsetValue, targetTypes.Length).ToArray(); } } public class OrMultiBoolValueConverter : IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values != null && values.All(v => v is bool boolValue)) { return values.Cast().Any(v => v); } return DependencyProperty.UnsetValue; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { return Enumerable.Repeat(DependencyProperty.UnsetValue, targetTypes.Length).ToArray(); } } }