/// <summary> /// Recursively instantiates components specified by descriptors in the hierarchy /// </summary> /// <param name="assignToDescriptor">Register to transform, and put into registry so it is available by clicking</param> public virtual void InstantiateChildren(bool assignToDescriptor) { // getting references to collections var childGroupDescriptors = DesignerReflection.GetChildGroupsReferences(this); foreach (ChildGroupDescriptor groupDescriptor in childGroupDescriptors) { List <ComponentAdapter> childAdapters = groupDescriptor.GetChildAdaptersCollection(this); if (null == childAdapters) { continue; } if (null == Component) // not instantiated { return; } Group targetContainer; if (null != groupDescriptor.TargetContainerMemberInfo) { /** * 1. Try reading the member as a Group * */ targetContainer = (Group)CoreReflector.GetMemberValue( groupDescriptor.TargetContainerMemberInfo, Component ); } else { /** * 2. Try casting this to Group (if this is a Stage class for instance) * */ targetContainer = Component as Group; } ComponentAdapterUtil.PopulateContainer(Component, targetContainer, childAdapters.ToArray(), assignToDescriptor, false, true); } }