Stop Property Grid sorting

Grids for WPF Forum

The latest build of this product (v25.1.1) was released 3 months ago, which was before this thread was created.
Posted 1 days ago by Daniel Constantin - ModuleWorks GmbH
Version: 25.1.1
Avatar

Hi!

I have a property grid with PropertyModel s. Some of them has categories, other not. For some reason the PropertyModel s with categories are put above the ones without categories.

SortComparer="{x:Null}" did not worked also.

I want to not have any sorting.

Kind regards,

Daniel

[Modified 1 days ago]

Comments (1)

Posted 19 hours ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The PropertyGrid.SortComparer is what determines how items are sorted.  It flows down to the TypeDescriptorFactory.SortDataModels virtual method that uses the sort comparer, if available, to sort the child data models at each level.  Setting the SortComparer to null will effectively disable default sorting.

If I set PropertyGrid.SortComparer to null in our PropertyGrid Getting Started QuickStart, I see the Misc category (those properties without categories set) appearing first.  It could just be based on which property reflects first when sorting is disabled, that determines which category (its category) appears first.

If you would like to customize sorting behavior, you can create a class that inherits DataModelSortComparer, override the logic in that comparer's virtual methods, and set an instance of your class to PropertyGrid.SortComparer.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.