Expand All / Collapse All command

Grids for WPF Forum

Posted 1 year ago by rex hui
Version: 18.1.0671
Avatar

I just realized that there is keyboard shortcut Ctrl+* and Ctrl+/ to perform an expand all and collapse all of all items.

Are those two functions available to be call from the code?

I have added two buttons "expand all" and "collapse all" to the propertygrid dialog and I want to able to perform those two functions.

Thanks.

Comments (3)

Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

We don't have a public method for that functionality other than overriding the ProcessKeyDown method and passing it some mocked up KeyEventArgs.  Really the best way to expand all  is to recurse down your view-model tree and set each model's IsExpanded flag along the way.  The problem with expand all functionality is that for large trees that have time-consuming load times, expand all can be a blocking operation.  That's why manually recursing your tree and expanding view-models allows you to pick and choose which nodes to expand and how deep you want to go.  On the other hand, if your tree isn't very large or is fully-loaded in memory from the start, easy built-in programmatic expand all functionality might be nice.  Would you still like us to add public methods for what we call with the "Ctrl+*" and "Ctrl+/" keys?


Actipro Software Support

Posted 1 year ago by rex hui
Avatar

I think it would be nice to include those as public methods since they are available through shortcut keys.

Thank you very much!

Answer - Posted 1 year ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Rex,

Ok we will add ExpandAll and CollapseAll methods in the next build.


Actipro Software Support

The latest build of this product (v2019.1 build 0682) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.