public void SetBehaviourPropertyInTreeView() { // Remove the current element (if any) in the TreeCollection that is of BehaviourViewModelBase foreach (StateCollectionViewModelBase s in TreeCollection) { if (s is BehaviourViewModelBase) { TreeCollection.Remove(s); break; } } if ((Behaviour != null) && ((Behaviour.Type == "breakableObject") || (Behaviour.Type == "scene"))) { TreeCollection.Insert(0, Behaviour.BehaviourProperties); } }