mirror of https://github.com/ogoun/Zero.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
using System;
|
|
using System.Windows.Data;
|
|
|
|
namespace ZeroLevel.WPF
|
|
{
|
|
public class BooleanAndConverter : IMultiValueConverter
|
|
{
|
|
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
foreach (object value in values)
|
|
{
|
|
if ((value is bool) && (bool)value == false)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException("BooleanAndConverter is a OneWay converter.");
|
|
}
|
|
}
|
|
|
|
public class BooleanOrConverter : IMultiValueConverter
|
|
{
|
|
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
foreach (object value in values)
|
|
{
|
|
if ((value is bool) && (bool)value == true)
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
throw new NotSupportedException("BooleanAndConverter is a OneWay converter.");
|
|
}
|
|
}
|
|
}
|