Leave PropertyGridPropertyItems unsorted

Grids for WPF Forum

Posted 10 years ago by wpf.acp
Version: 9.1.0503
Avatar
Is there a way for the PropertyGrid to show PropertyGridPropertyItems in the order they appear in XAML without any attempt to sort them (either by property name or category name)?

Comments (6)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe if you clear the PropertyGrid.SortDescriptions collection, then the items will be displayed in the order they are defined.


Actipro Software Support

Posted 10 years ago by wpf.acp
Avatar
Clear how exactly?

I am not using SortDescriptions to begin with and the default behavior is to sort both categories and properties.

I have also tried
<Controls:PropertyGrid.SortDescriptions />
without the desired effect.

Please advise.
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

You cannot clear collections in XAML, you can only add to them. To clear the collection you would need to do it via a code-behind file. If your PropertyGrid is named "propgrid", then you'd call "propgrid.SortDescriptions.Clear()".

I've add a property in the next maintenance release that will allow you to turn off the default sort descriptions, so you'd be able to do it via XAML.


Actipro Software Support

Posted 10 years ago by wpf.acp
Avatar
Adding a property seems like a good way to go. Thanks a lot.
Posted 10 years ago by Mick
Avatar
Is there any way to have items sorted in a custom manner (or remove sorting altogether) for a specific category, while leaving other categories alone?

In addition, is there any way for me to specify that I want a particular category to be displayed above or below a different category (I'm using the property grid to display several properties defined through an inheritance hierarchy, so defining them in the order I want them to display is near impossible)?

Thank you,
Mick
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Mick,

We've just added enhanced sorting capabilities to the PropertyGrid, which will allow you to use any custom logic. This will be included in the next maintenance release.

In previous versions, the only way to apply custom sorting logic was to implement a custom DataFactory that would sort the items before the were passed to the PropertyGrid for display.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) 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.