Skip to content

CategoryOrderAttribute not working as intended #842

Open
@xceedsoftware

Description

@xceedsoftware

arobincaron[CodePlex]
The property grid ObjectContainerHelper class uses Type.GetCustomAttributes() to get the CategoryOrderAttribute instead of using TypeDescriptor.GetAttributes(). This is inconsistent with the way these types of attributes are retreived for the rest of property
grid and prevents adding this metadata attribute for classes that lack it.

In Xceed.Wpf.Toolkit\PropertyGrid\Implementation\ObjectContainerHelper.cs around line 109 I changed the following code:
CategoryOrderAttribute[] orderAttributes = ( selectedObject != null )
? ( CategoryOrderAttribute[] )selectedObject.GetType().GetCustomAttributes( typeof( CategoryOrderAttribute ), true )
: new CategoryOrderAttribute[ 0 ];

to
CategoryOrderAttribute[] orderAttributes = (selectedObject != null)
? TypeDescriptor.GetAttributes(selectedObject.GetType()).OfTypeltCategoryOrderAttributegt().ToArray()
: new CategoryOrderAttribute[0];

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions