public ChildCOViewModel( TreeViewViewModel treeParent, CompoundObjectViewModel parentVm, MainViewModel mainVm, TStateProperties <ChildObjectStateProperties> childStateModelObject, bool enabled = true) : base(treeParent, parentVm, mainVm, childStateModelObject.Properties.CompObj) { ChildStateModelObject = childStateModelObject; // Below we need to find the top level behavior. Must get it from the MainViewModel! int i = MainVm.GetEditableCoBehaviourIndexOf(ChildStateModelObject.State); if (i < 0) { i = 0; } SelectedStateIndex = i; }
public ChildObjectStatePropertiesViewModel( TreeViewViewModel treeParent, CompoundObjectViewModel parentVm, MainViewModel mainVm, TStateProperties <ChildObjectStateProperties> modelObject, bool enabled = true) : base(treeParent, parentVm, mainVm, enabled) { ModelObject = modelObject; CompoundObjectViewModel covm = new CompoundObjectViewModel(this, parentVm, mainVm, modelObject.Properties.CompObj, enabled); SingleObjectCollectionChild.Add(covm); OnPropertyChanged("CompoundObjectChild"); SingleObjectCollectionChild.CollectionChanged += this.OnCollectionChanged; // Since this COVM is the child of another COVM we need to check if the COVM // is a reference to a file or not. If it is, the children of the COVM shall // not be selectable, i.e. they shall be disabled. If it it is not a file ref // it shall be selectable. if (CompoundObjectChild.IsFileReferenceChild) { CompoundObjectChild.BuildViewModel(false); } else { CompoundObjectChild.BuildViewModel(true); } int i = mainVm.GetEditableCoBehaviourStateIndex(); if (i < 0) { i = 0; } SelectedStateIndex = i; }