How can I know when the user expands or collapses a category in the property grid control?

Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

The categorized grid (CExtPropertyGridWndCategorized) in the property grid (CExtPropertyGridCtrl) is derived from the CExtTreeGridWnd class, which has a CExtTreeGridWnd::ItemExpand() virtual method that is invoked when an item with sub items is expanded or collapsed:

virtual void ItemExpand(
bool bRedraw = true

You can override the CExtPropertyGridCtrl::OnPgcCreateGrids() virtual method in order to create a CExtPropertyGridWndCategorized-derived property grid in which the CExtTreeGridWnd::ItemExpand() virtual method is overridden (do to forget to call the ItemExpand() method of the base class).

You may also need to make a conversion between handles to HTREEITEM items of the tree grid and pointers to CExtPropertyItem items of the property grid. You can use the CExtPropertyGridWnd::PropertyItemToTreeItem() and CExtPropertyGridWnd::PropertyItemFromTreeItem() methods for that.