"Declare a third sort order named "unsorted". Let it be the default. If there are no categories defined, sort the properties as they were declared (unsorted). If a category is defined, sort the properties unsorted under this category. When you select alphabetically they are sorted alphabetically. If a PropertyCustomSortAttribute exists, you can sort to that. "
Comments: ** Comment from web user: BoucherS **
In the PropertyGrid, we use the methods
-TypeDescriptor.GetProperties( instance.GetType() );
-Type.GetProperties();
1) As said by Microsoft : "The GetProperties method does not return properties in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which properties are returned, because that order varies."
http://msdn.microsoft.com/en-us/library/vstudio/aky14axb(v=vs.100).aspx
2) Also, as said by Microsoft : "The order of the returned collection is not guaranteed to be identical between calls, so always order it before use."
http://msdn.microsoft.com/en-us/library/vstudio/y28y51d8(v=vs.100).aspx
3) In WindowsForms, the PropertyGrid can use a PropertySort = NoSort, which is : "Properties are displayed in the order in which they are retrieved from the TypeDescriptor." This typeDescriptor has a GetProperties( Type ) method which says : "The order of the returned collection is not guaranteed to be identical between calls, so always order it before use."
http://msdn.microsoft.com/en-us/library/y28y51d8(v=vs.110).aspx
So using "NoSort" can display the properties in any order, not always the way the properties were declared in the class.
that is why the PropertySortAttribute can be your friend to sort the properties the way you want.