Sorting collections of properties

Grids for WPF Forum

Posted 6 years ago by Jan Pilger - Steinbichler Optotechnik GmbH
Version: 13.1.0582
Environment: Windows 7 (64-bit)
Avatar

I'm using the attributes of System.Componentmodel to control the PropertyGrid. Some of the displayed properties are collections with an ExpandableObjectConverter (or ArrayConverter) attribute. Unfortunately these collections are sorted alphabtically by the item index: 0, 1, 10, 11, 12, 13, 14, 15, 16 ,17 ,18 ,19, 2, 20 21, ... I couldnt figure out how to prevent the PropertyGrid from sorting this way and maintaining the original order. Can you give me a hint?

Thanks!

Comments (1)

Answer - Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

Our Sorting QuickStart under PropertyGrid includes an example of sorting by numeric value first, then by the display name of the property. The NumericValueComparer class is what performs the custom sorting, and you simply need to set the PropertyGrid.SortComparer to an instance of this class.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) was released 15 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.