1234567891011121314151617181920212223242526272829303132333435 |
- using System.Globalization;
- using System.Windows.Data;
- namespace UniformMaterialManagementSystem.Converters
- {
- public class ContentToBoolConverter: IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null || parameter == null)
- {
- return false;
- }
- string checkvalue = value.ToString();
- string targetvalue = parameter.ToString();
- bool r = checkvalue.Equals(targetvalue);
- return r;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- //if (value == null || parameter == null)
- //{
- // return null;
- //}
- //if ((bool)value)
- //{
- // return parameter.ToString();
- //}
- //return null;
- return (bool)value ? parameter : Binding.DoNothing;
- }
- }
- }
|