using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; namespace PDF_Master.DataConvert { public class StringToVisibleConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null || string.IsNullOrEmpty((string)value)) { return Visibility.Collapsed; } else { if (value is string && (value as string).Length > 0) { return Visibility.Visible; } else { return Visibility.Collapsed; } } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } } public class StringToUnVisibleConvert : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return Visibility.Visible; } else { if (value is string && (value as string).Length > 0) { return Visibility.Collapsed; } else { return Visibility.Visible; } } } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return null; } } }