Beispiel #1
0
        /// <summary>
        /// Create a value binding.
        /// </summary>
        public IValueBinding CreateValueBinding(object parentObject, object value, Type type)
        {
            IValueBinding valueBinding;

            //
            // Recurse if neccessary and setup bindings for subobjects.
            //
            if (RecurseTypeForBindings(type))
            {
                // Get the sub-object from the property.
                if (type.IsArray)
                {
                    valueBinding = new ArrayBinding((Array)value, this);
                }
                else if (value is IList)
                {
                    valueBinding = new ListBinding((IList)value, this);
                }
                else
                {
                    valueBinding = new ObjectBinding(value, this);
                }
            }
            else
            {
                valueBinding = new PrimitiveBinding(value);
            }
            return(valueBinding);
        }
 /// <summary>
 /// Create a value binding.
 /// </summary>
 public IValueBinding CreateValueBinding(object parentObject, object value, Type type)
 {
     IValueBinding valueBinding;
     //
     // Recurse if neccessary and setup bindings for subobjects.
     //
     if (RecurseTypeForBindings(type))
     {
         // Get the sub-object from the property.
         if (type.IsArray)
         {
             valueBinding = new ArrayBinding((Array)value, this);
         }
         else if (value is IList)
         {
             valueBinding = new ListBinding((IList)value, this);
         }
         else
         {
             valueBinding = new ObjectBinding(value, this);
         }
     }
     else
     {
         valueBinding = new PrimitiveBinding(value);
     }
     return valueBinding;
 }