Hi,
We are extending the property grid by inheriting from ActiproSoftware.Windows.Controls.PropertyGrid.PropertyGrid to allow us to keep the expanded/collapsed state of the property grid categories when a user selects different objects. This works fine for actual categories but not so much for properties that have sub-properties.
For instance, we have an Appearance Category that contains a Border property (which itself contains 3 sub-properties). In the overridden PrepareContainerForItemOverride method I can determine which categories I need to stay open from object to object by use of a generic list that I save/remove based on collapsed and expanded events. When I expand the Border property to display the 3 sub-properties, the originalsource (from the Expanded event) is the Border which at that time is of type PropertyGridDataAccessorItem. When in the PrepareContainerForItemOverride method I can work with the list of Categories and set the expanded/collapsed state of each. When I get to the Appearance Category, it contains 11 Accessors of which Border is one. I have tried holding on to the PropertyGridDataAccessorItem I obtained from the expanded event for the Border property and have tried to cast it to a TreeListView (which is successful), and then set the IsExpanded property to true but the Border Property still displays in a collapsed state on a new object selection.
Any ideas or suggestions are appreciated.
Thanks,
Mike
[Modified at 05/25/2010 01:24 PM]
We are extending the property grid by inheriting from ActiproSoftware.Windows.Controls.PropertyGrid.PropertyGrid to allow us to keep the expanded/collapsed state of the property grid categories when a user selects different objects. This works fine for actual categories but not so much for properties that have sub-properties.
For instance, we have an Appearance Category that contains a Border property (which itself contains 3 sub-properties). In the overridden PrepareContainerForItemOverride method I can determine which categories I need to stay open from object to object by use of a generic list that I save/remove based on collapsed and expanded events. When I expand the Border property to display the 3 sub-properties, the originalsource (from the Expanded event) is the Border which at that time is of type PropertyGridDataAccessorItem. When in the PrepareContainerForItemOverride method I can work with the list of Categories and set the expanded/collapsed state of each. When I get to the Appearance Category, it contains 11 Accessors of which Border is one. I have tried holding on to the PropertyGridDataAccessorItem I obtained from the expanded event for the Border property and have tried to cast it to a TreeListView (which is successful), and then set the IsExpanded property to true but the Border Property still displays in a collapsed state on a new object selection.
Any ideas or suggestions are appreciated.
Thanks,
Mike
[Modified at 05/25/2010 01:24 PM]