How to expand only one level of nested objects?

Grids for WPF Forum

Posted 9 years ago by Duncan Woods
Version: 11.1.0545

I have a nested object hierarchy e.g.


Where each level might be an object or an expandable collection.


I would like to show the selected object and then allow just one level below this to be expandable. Anything deeper that one level below the selected object should be hidden. I want to be able to set any of A, B, C or D as the selected object and still have just one level belwo the chosen object as expandable.

With different selected objects, this would mean the user would see e.g.







Could I control the depth of visible expandable objects at run-time?


[Modified at 08/12/2011 10:55 AM]

[Modified at 08/12/2011 10:59 AM]

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Duncan,

To accomplish this, you would probably have to use a custom datafactory, such as on that derives from TypeDescriptorFactory. When the factory's GetProperties(object, DataFactoryOptions) method is called for sub-properties, you can return null when appropriate. The second parameter passed in is for options, which allows access to the parent, if there is one.

There is a "Factories" documentation topic that gives some information about factories, and the two "Selective" QuickStarts show usage of custom data factories.

Actipro Software Support

Posted 9 years ago by Duncan Woods
Awesome, thanks. I'll let you know how I get on.
The latest build of this product (v2020.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.