/// <summary> /// Converts source values to a value for the binding target. The data binding /// engine calls this method when it propagates the values from source bindings /// to the binding target. /// </summary> /// <param name="values"> /// The array of values that the source bindings in the System.Windows.Data.MultiBinding /// produces. The value System.Windows.DependencyProperty.UnsetValue indicates /// that the source binding has no value to provide for conversion. /// </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.A /// return value of System.Windows.DependencyProperty.System.Windows.DependencyProperty.UnsetValue /// indicates that the converter did not produce a value, and that the binding /// will use the System.Windows.Data.BindingBase.FallbackValue if it is available, /// or else will use the default value.A return value of System.Windows.Data.Binding.System.Windows.Data.Binding.DoNothing /// indicates that the binding does not transfer the value or use the System.Windows.Data.BindingBase.FallbackValue /// or the default value. /// </returns> public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture) { var text = new List <string>(); ConnectionInformationViewModel model = null; foreach (var obj in values) { if (obj is string) { text.Add(obj as string); continue; } if (obj is ConnectionInformationViewModel) { model = obj as ConnectionInformationViewModel; } } if (text.Count == 1) { return(Tuple.Create(text[0], model)); } if (text.Count == 2) { return(Tuple.Create(text[0], text[1], model)); } return(null); }
public ConnectionInformation(ConnectionInformationViewModel ViewModel) { InitializeComponent(); ViewModel.DisplayErrorHandler = DisplayError; BindingContext = _ViewModel = ViewModel; }