Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AndMultiConverter.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 using System;
4 using System.Globalization;
5 using System.Linq;
6 using System.Windows;
7 
8 namespace SiliconStudio.Presentation.ValueConverters
9 {
10  public class AndMultiConverter : OneWayMultiValueConverter<AndMultiConverter>
11  {
12  public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
13  {
14  if (values.Length < 2)
15  throw new InvalidOperationException("This multi converter must be invoked with at least two elements");
16 
17  return values.All(x => x != DependencyProperty.UnsetValue && (bool)x);
18  }
19  }
20 }
override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)