private SingleValueBindingModel CreateSingleValueBindingModel(Binding binding, Argument arg, ArgumentEntity argEntity, int valueIndex)
        {
            var svbm = new SingleValueBindingModel();

            Fill(svbm, binding, arg, argEntity);

            if (binding.Values.Count > valueIndex)
            {
                svbm.Value = CreateValueEntity(binding.Values[valueIndex]);
            }
            else
            {
                svbm.Value = new ValueEntity();
            }

            if (binding.Control.ControlType == ControlTypes.Check)
            {
                svbm.Value.IsSelected = svbm.Control.Properties.Selected();

                // at least initialize the bool value to false.
                if (!svbm.Value.IsSelected.HasValue)
                {
                    svbm.Value.IsSelected = false;
                }
            }

            return(svbm);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a deep copy of this instance.
        /// </summary>
        /// <returns>Never returns null.</returns>
        public override ValueBindingModel Clone()
        {
            var clone = new SingleValueBindingModel();

            CopyTo(clone);

            return(clone);
        }
Ejemplo n.º 3
0
        private void CopyTo(SingleValueBindingModel target)
        {
            base.CopyTo(target);

            target.Value = (this.Value == null) ? null : this.Value.Clone();
        }