/// <summary> /// All Bindings must be equal to the specified value in the ConverterParameter string before the "?" to return /// the value after the last "?". else value after ":" is returned /// /// SAMPLE: /// <TextBlock.Visibility> /// <MultiBinding Converter = "{converterHelperSample:IsEqualConverter}" /// ConverterParameter="a?Visible:Collapsed"> /// <Binding ElementName = "ReasonTextBox" /// Path="Text" /> /// <Binding ElementName = "TestComboBox" /// Path="Text" /> /// </MultiBinding> /// </TextBlock.Visibility> /// </summary> /// <param name="values">The value produced by the binding source.</param> /// <param name="targetType">The type of the binding target property.</param> /// <param name="parameter">The converter parameter to use.</param> /// <param name="culture">The culture to use in the converter.</param> /// <returns> /// A converted value. If the method returns null, the valid null value is used. /// </returns> public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { var parameterString = parameter.ToString(); bool isTrue = false; if (parameterString.Contains("?")) { var compareValue = parameterString.Substring(0, parameterString.IndexOf("?", StringComparison.Ordinal)); isTrue = values.All(i => i?.ToString() == compareValue); } else { isTrue = values.Skip(1).All(i => i?.ToString() == values[0]?.ToString()); } return(ConverterHelper.Result <bool?>(isTrue, i => i, targetType, parameter)); }