32 lines
887 B
C#
32 lines
887 B
C#
using System;
|
|
using System.Globalization;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace eJay.Converters
|
|
{
|
|
[ValueConversion(typeof(bool), typeof(Visibility))]
|
|
public class BoolToVisibilityConverter : IValueConverter
|
|
{
|
|
public Visibility TrueValue { get; set; }
|
|
public Visibility FalseValue { get; set; }
|
|
|
|
public BoolToVisibilityConverter()
|
|
{
|
|
// set defaults
|
|
FalseValue = Visibility.Hidden;
|
|
TrueValue = Visibility.Visible;
|
|
}
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
return (bool)value ? TrueValue : FalseValue;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
}
|
|
}
|