/// <summary> /// Creates a property bag for a given object /// </summary> private static PropertyBag CreatePropertyBag( object obj ) { if ( obj == null ) { return null; } //if ( obj is IObjectEditor ) //{ // return CreatePropertyBag( obj ); //} ISelectionModifier modifier = obj as ISelectionModifier; if ( modifier != null ) { obj = modifier.SelectedObject; } ExPropertyBag bag = new ExPropertyBag( obj ); return bag; }
/// <summary> /// Builds the property grid from the current object selection /// </summary> private void BuildPropertyGrid( ) { object[] selectedObjects = EditorState.Instance.CurrentSelection.ToArray( ); if ( selectedObjects.Length == 0 ) { objectPropertyGrid.SelectedObject = null; return; } PropertyBag[] bags = new ExPropertyBag[ selectedObjects.Length ]; for ( int index = 0; index < selectedObjects.Length; ++index ) { bags[ index ] = CreatePropertyBag( selectedObjects[ index ] ); } objectPropertyGrid.SelectedObjects = bags; }