// All children CompoundObjectViewModels are created here. The constructor of the ChildObjectViewModel // creates a ChildObjectStatePropertiesViewModel which's constructor creates the CompoundObjectViewModel. private StateChildCollectionViewModel SetChildren(CompoundObject ModelObject, bool enabledChildren = true) { StateChildCollectionViewModel schcvm = new StateChildCollectionViewModel(this, this, MainVm, enabledChildren); foreach (ChildObject cho in ModelObject.ChildObjects) { ChildObjectViewModel chovm = new ChildObjectViewModel(schcvm, this, MainVm, cho, enabledChildren); schcvm.Children.Add(chovm); } return(schcvm); }
public CompoundObjectViewModel( TreeViewViewModel treeParent, CompoundObjectViewModel parentVm, MainViewModel mainVm, CompoundObject modelObject, bool enabled = true) : base(treeParent, parentVm, mainVm, enabled) { ModelObject = modelObject; Behaviour = new CoBehaviourViewModel(TreeParent, this, MainVm, ModelObject.Behaviour); SelectedBehaviourIndex = Behaviours.IndexOf(ModelObject.Behaviour.Type); ChildObjectsWithStates = new StateChildCollectionViewModel(treeParent, parentVm, MainVm); }