コード例 #1
0
        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
            };
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: PieceItem.cs プロジェクト: sabihoshi/Furniture
        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
            };
        }
コード例 #4
0
        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);
            }
        }