private static void CreateObjectOfSelectedType(Window callingWindow) { CollapseListBox collapseListBox = callingWindow as CollapseListBox; Type type = collapseListBox.GetFirstHighlightedObject() as Type; mObjectToSerialize = Activator.CreateInstance(type); mTypeOfObjectToSerialize = type; if (PropertyGrid.IsIEnumerable(type)) { mObjectListDisplayWindow = CreateListDisplayWindowForObject(mObjectToSerialize); } else { mObjectPropertyGrid = CreatePropertyGridForObject(mObjectToSerialize); } }