Question

PropertyGrid - Select and focus first property

Posted 7 months ago by Avatar Wiley Knoch

I have a PropertyGrid I am showing on a popup dialog.  The requirement is when the dialog shows and the property grid is populated I need to select and put focus in the first (or any particular) property of the grid.

I have found several ways to do this using theItemContainerGenerator.ItemFromContainer to get the tree item and then set it selected.  But my problem is I need to do this as soon as the grid is populated and I cannot find any notification of when the visual tree for the grid is done.  Or maybe there is an even better way of handling this, any help is appreciated.


Comments (3)

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA

Hi Wiley,

Check out our PropertyGridSettingFocus QuickStart sample.  It shows an easy way to focus a property model.

I believe if you do that, even before containers are generated, it will flag which property model should get focus when its container is generated.  Worst case scenario if that didn't work, you could do your focus call after the propGrid.ItemContainerGenerator.StatusChanged event indicated containers were generated.


Actipro Software Support
Posted 7 months ago by Wiley Knoch

Where do I find these QuickStart samples?

<EDIT, found it in the Browser sample application, thanks>

[Modified 7 months ago]

Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA

They are in the main sample project that gets installed by default and has samples for all our products.  That particular sample is in this relative path to the root of the project:

\ProductSamples\GridsSamples\QuickStart\PropertyGridSettingFocus


Actipro Software Support
Information The latest build of this product (2018.1 build 0671) was released 1 month ago, which was after the last post in this thread.

Add a Comment

Please log in to a validated account to post comments.