Browse through property grid items

Grids for WPF Forum

Posted 13 years ago by Jb RIGUET
Version: 11.1.0543
Avatar
Hi,

We achieved to iterate through every control item in the property grid via the KeyDown event, using the Items property on the PropertyGrid.
Sadly, just after setting the SelectedObjects property, the Items are empty. Even setting the IsAsynchronous property to false, or using some events, like the SelectedObjectsChanged event, we don't find an appropriate time where the Items are filled correctly.

The goal is to iterate through every item at runtime, to control with differents ways (attributes, dynamic settings) the behavior and display of properties in the PropertyGrid.

Thanks,

JB

[Modified at 06/15/2011 03:04 AM]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

The PropertyGrid is an ItemsControl, like the native WPF TreeView. The containers (i.e. PropertyGridDataAccessorItem) for the items will not be created until they are needed. So if you have a collapsed category with 5 properties, then containers for the 5 properties will not be created until the category is expanded. This is a standard behavior for WPF ItemsControls.

It is not easy to track when the various containers are created, and in the case of virtualization they can be created and destroyed often when scrolling. You can use the ItemContainerGenerator and it's StatusChanged even to determine when containers have been generated. But you'd have to attach to that event on the PropertyGrid, and every PropertyGridDataAccessorItem, as those are ItemsControls also (just like TreeViewItem).

Typically any customization is performed using Styles. You can define an implicit Style or use the ItemContainerStyle/ItemContainerStyleSelector on the PropertyGrid.


Actipro Software Support

The latest build of this product (v24.1.3) was released 27 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.