1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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_Office.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;
- }
- }
- }
|