using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Data; namespace Txgy.EWS.Client.Common.Converters { public class Bool2VisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { bool result = false; if (value != null && bool.TryParse(value.ToString(), out result)) { if (result) return System.Windows.Visibility.Visible; } return System.Windows.Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }