2015-07-05 11:09:59 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
|
2015-07-06 13:41:46 +01:00
|
|
|
|
namespace Filtration.Common.Converters
|
2015-07-05 11:09:59 +01:00
|
|
|
|
{
|
|
|
|
|
internal class InverseBooleanVisibilityConverter : IValueConverter
|
|
|
|
|
{
|
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
if (value is bool && targetType == typeof (Visibility))
|
|
|
|
|
{
|
|
|
|
|
var val = (bool) value;
|
|
|
|
|
if (val)
|
|
|
|
|
{
|
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
|
}
|
|
|
|
|
if (parameter is Visibility)
|
|
|
|
|
{
|
|
|
|
|
return parameter;
|
|
|
|
|
}
|
|
|
|
|
return Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
|
|
|
|
return Visibility.Collapsed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (parameter is Visibility)
|
|
|
|
|
{
|
|
|
|
|
return parameter;
|
|
|
|
|
}
|
|
|
|
|
return Visibility.Visible;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
|
|
|
{
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|