Sorting collections of properties

Grids for WPF Forum

Posted 11 years ago by Jan Pilger - Steinbichler Optotechnik GmbH
Version: 13.1.0582
Platform: .NET 4.5
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 11 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 (v24.1.3) 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.