diff options
Diffstat (limited to 'Codemerx/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs')
| -rw-r--r-- | Codemerx/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs b/Codemerx/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs new file mode 100644 index 0000000..e59ded6 --- /dev/null +++ b/Codemerx/Gestor.Common/Gestor.Common.Converters/MultiBoolAndConverter.cs @@ -0,0 +1,35 @@ +using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Runtime.CompilerServices;
+using System.Windows.Data;
+
+namespace Gestor.Common.Converters
+{
+ public class MultiBoolAndConverter : IMultiValueConverter
+ {
+ public MultiBoolAndConverter()
+ {
+ }
+
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ object obj;
+ try
+ {
+ obj = ((IEnumerable<object>)values).All<object>((object value) => (bool)value);
+ }
+ catch
+ {
+ obj = false;
+ }
+ return obj;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file |