using System; using System.Windows; using System.Windows.Data; using System.Globalization; namespace SHJX.Service.Common.Converters { public class BoolToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value==null) { return DependencyProperty.UnsetValue; } var isCanExcute = (bool)value; return isCanExcute ? Visibility.Visible : Visibility.Hidden as object; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }