public PlywoodItem(IParent parent) : base(parent) { var builder = new CaptionBuilder(this); Thickness = builder.CreateComboBox(nameof(Thickness), App.Config.Plywood); Quantity = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1); Fields = new BindableCollection <IHasValue> { Thickness, Quantity }; }
public ComboBoxViewModel(IParent parent, List <ComboBoxItem <T> > values, string caption, TryParse tryParse) : base(parent, caption, tryParse) { Values = values; SelectedValue = Values?.First(); if (tryParse != null) { OtherCaption = new OtherInputViewModel <T>(this, tryParse); Values?.Add(Other); } }
public PieceItem(IParent parent, Piece material) : base(parent) { _material = material; var builder = new CaptionBuilder(this); Amount = builder.CreateComboBox(nameof(Amount), App.Config.PieceValues, decimal.TryParse, "PHP", _material.Value); Quantity = builder.CreateTextBox(nameof(Quantity), int.TryParse, value: 1); Fields = new BindableCollection <IHasValue> { Amount, Quantity }; }
public ComboBoxViewModel(IParent parent, List <ComboBoxItem <T> > values, string caption, string label, TryParse tryParse, ComboBoxItem <T> value = null) : base(parent, caption, label, tryParse) { _tryParse = tryParse; Values = new BindableCollection <ComboBoxItem <T> >(values); SelectedValue = value ?? Values?.FirstOrDefault(); if (tryParse != null) { Other = new ComboBoxItem <T>("Other...", SelectedValue.Value); Values?.Add(Other); } }