/// <summary> /// A static utility method to find a child data object in the given object by the specified /// dot-delimited path to the child object. /// </summary> /// <param name="obj">The parent object to find the child object in.</param> /// <param name="childPath">A dot-delimited path to the child object.</param> /// <returns></returns> public static IDataObject FindChildObject(DataObject obj, string childPath) { if (string.IsNullOrEmpty(childPath) || obj == null) return obj; int idx = childPath.IndexOf("."); if (idx < 0) return obj.GetChildObject(childPath); DataObject child = obj.GetChildObject(childPath.Substring(0, idx)) as DataObject; return FindChildObject(child, childPath.Substring(idx + 1)); }
/// <summary> /// Constructs a base property with the given name and a parent data object. /// </summary> /// <param name="parent">The parent data object for the property.</param> /// <param name="name">Property name that should be unique within the parent object.</param> public BaseProperty(DataObject parent, string name) { this.parent = parent; this.Name = name; }
/// <summary> /// Constructs the data property with a given name /// and adds it to the parent data object under this name. /// </summary> /// <param name="parent">The parent data object to add the property to if applicable.</param> /// <param name="name">The property name that should be unique within the parent data object.</param> public DataProperty(DataObject parent, string name) : base(parent, name) { if (parent != null) parent.AddProperty(this); Change += ValidateOnStopEditing; }
/// <summary> /// Binds the framework element to the given data object. /// </summary> /// <param name="obj">The data object to bind the framework element to.</param> public virtual void BindTo(DataObject obj) { context = obj; }