private void BuildInputAttr(AttrRecord attr)
        {
            //Ex.Log($"{nameof(BuildInputAttr)}(): ATTR input: attr={attr.Name}");
            string hint = attr.Name;

            if (attr.Mandatory != null && attr.Mandatory == "1")
            {
                hint += '*';
            }
            var inputbox = Controls.TextBoxHint(hint, around);

            inputbox.CharacterCasing = CharacterCasing.Upper;
            if (!string.IsNullOrEmpty(attr.MaxLength))
            {
                int maxLength;
                if (int.TryParse(attr.MaxLength, out maxLength))
                {
                    inputbox.MaxLength = maxLength;
                }
            }
            if (!string.IsNullOrEmpty(attr.Type) && (attr.Type == "I" || attr.Type == "R"))
            {
                inputbox.InputScope = new InputScope()
                {
                    Names = { new InputScopeName(InputScopeNameValue.Number) }
                };
            }
            if (!string.IsNullOrEmpty(attr.Hint))
            {
                //HintAssist.SetHelperText(inputbox, attr.Hint);
            }
            AttrValidationVM vmAttr = vmodel.GetNewAttrVM(attr);

            inputbox.DataContext = vmAttr;

            //int index = vmodel.PayrecToSend.AttrRecord.FindIndex(x => x == attr);
            var binding = new Binding($"{nameof(vmAttr.ValueAttrRecord)}");

            binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            binding.Mode = BindingMode.TwoWay;
            inputbox.SetBinding(TextBox.TextProperty, binding);

            views.AddControl(inputbox);
        }
Esempio n. 2
0
 public AttrValidationVM(AttrRecord AttrRecord) : this()
 {
     _attrRecord = AttrRecord;
 }