using System; using System.Globalization; using System.Windows; using System.Windows.Data; namespace HashCalculator.GUI { [ValueConversion(typeof(string), typeof(Visibility))] public class NullToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var text = value as string; return string.IsNullOrEmpty(text) ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }