public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (TrueValue == null) { return((value == null) ^ Invert); } bool b = TrueValue.Equals(value) ^ Invert; return(InnerConverter == null ? b : InnerConverter.Convert(b, targetType, parameter, culture)); }
/// <summary>Converts the specified <paramref name="value"/> to a <see cref="Boolean"/>.</summary> /// <param name="value">The value to convert.</param> /// <param name="targetType">The type that is expected by the caller.</param> /// <param name="parameter">The converter parameters.</param> /// <param name="culture">The culture information for this conversion.</param> /// <returns>True if the specified <paramref name="value"/> matches the value of the <seealso cref="TrueValue"/>, otherwise False.</returns> public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { Visibility realVal = FalseValue; string valueStr = value == null ? string.Empty : value.ToString(); try { realVal = (Visibility)Enum.Parse(typeof(Visibility), valueStr); } catch { realVal = FalseValue; } return(TrueValue.Equals(realVal)); }
public object ConvertBack(object value, Type targetType, object parameter, string language) { if (TrueValue.Equals(value)) { return(Test); } else if (FalseValue.Equals(value)) { return(!Test); } return(false); }
public object ConvertBack(object value, Type targetType, object parameter, string language) { return(TrueValue.Equals(value) ? true : false); }
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return(TrueValue.Equals(value) ? true : false); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return(TrueValue.Equals(value)); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return(TrueValue?.Equals(value?.ToString(), StringComparison.OrdinalIgnoreCase) ?? false); //return "true".Equals(value?.ToString().ToLower()) ? TrueValue : FalseValue; }