public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } var valueBinding = new Binding("Value") { UpdateSourceTrigger = UpdateSourceTrigger.LostFocus }; switch (value) { case int _: return(EditorConverterHelper.GetIntegerEditor(valueBinding)); case double _: return(EditorConverterHelper.GetDoubleEditor(valueBinding)); case string _: return(EditorConverterHelper.GetTextEditor(valueBinding)); case bool _: return(EditorConverterHelper.GetBoolCheckBoxEditor(valueBinding)); } return(null); }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } var valueBinding = new Binding(parameter?.ToString() ?? "StartValue") { UpdateSourceTrigger = UpdateSourceTrigger.LostFocus }; switch (value) { case IntParam intParam: return(EditorConverterHelper.GetIntegerEditor(valueBinding, intParam.MinValue, intParam.MaxValue, intParam.IsReadOnly)); case DoubleParam doubleParam: return(EditorConverterHelper.GetDoubleEditor(valueBinding, doubleParam.MinValue, doubleParam.MaxValue, doubleParam.IsReadOnly)); default: return(new TextBlock { Background = Brushes.Transparent, Foreground = Brushes.Gray, HorizontalAlignment = HorizontalAlignment.Center, Text = "N/A" }); } }
public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } var valueBinding = new Binding("Value") { UpdateSourceTrigger = UpdateSourceTrigger.LostFocus }; switch (value) { case IntParam intp: return(EditorConverterHelper.GetIntegerEditor(valueBinding, intp.MinValue, intp.MaxValue, intp.IsReadOnly)); case DoubleParam doubleP: return(EditorConverterHelper.GetDoubleEditor(valueBinding, doubleP.MinValue, doubleP.MaxValue, doubleP.IsReadOnly)); case StringParam stringP: if (stringP.AllowedValues.Count > 0) { return(EditorConverterHelper.GetComboboxEditor(valueBinding, stringP.AllowedValues)); } else { return(EditorConverterHelper.GetTextEditor(valueBinding)); } case BoolParam _: return(EditorConverterHelper.GetBoolCheckBoxEditor(valueBinding)); } return(null); }