How can I customize the sorting of categories in a PropertyGrid?
If I set either of the following...
propertyGrid.PropertySort = PropertySort.Categorized; propertyGrid.PropertySort = PropertySort.CategorizedAlphabetical; ... then the categories will be alphabetized. ("Alphabetical" would seem to apply to the properties within each category.) If I use PropertySort.NoSort, I lose categorization.
I'm populating my PropertyGrid with SelectObject, which is pretty easy:
this.propertyGrid1.SelectedObject = options; options is an instance of a class with suitably decorated properties:
[CategoryAttribute("Category Title"), DisplayName("Property Name"), Browsable(true), ReadOnly(false), BindableAttribute(true), DesignOnly(false), DescriptionAttribute("...")] public bool PropertyName { get { // ... } set { // ... this.OnPropertyChanged("PropertyName"); } } I have a few dozen properties in half a dozen categories.
Is there some way I can adjust the category sort order while preserving my ease of use with SelectedObject?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With