25 lines
743 B
C#
25 lines
743 B
C#
using System;
|
|
using System.Windows;
|
|
using System.Windows.Data;
|
|
|
|
namespace JD.WPF.Converters
|
|
{
|
|
public class EnumToVisibilityConverter : IValueConverter
|
|
{
|
|
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value.Equals(parameter))
|
|
return Visibility.Visible;
|
|
else
|
|
return Visibility.Collapsed;
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
|
|
{
|
|
if (value.Equals(Visibility.Visible))
|
|
return true;
|
|
else
|
|
return Binding.DoNothing;
|
|
}
|
|
}
|
|
}
|