Q:

How can you programmatically order categories in the Xceed PropertyGrid? 

As shown in the example here, what I'm trying to achieve is ordering categories in the Xceed PropertyGrid control. 
As that example shows (copied here for reference), you can specify this information at compile-time by adding attributes to the class, like so...
[CategoryOrder("General", 1)]
[CategoryOrder("Advanced", 2)]
[CategoryOrder("Other", 3)]
public class MyClass {
    [Category("General")]
    public string Property1 { get; set; }
    [Category("Advanced")]
    public int Property2 { get; set; }
    [Category("Other")]
    public double Property3 { get; set; }
    [Category("General")]
    public string Property4 { get; set; }
    [Category("Advanced")]
    public int Property5 { get; set; }
    [Category("Other")]
    public double Property6 { get; set; }
}

And it would appear in the PropertyGrid like this...

What I'm trying to do however is set the CategoryOrderAttribute values at runtime.   Here's what I'm trying, but it's not working...
// Note: This gets executed *prior* to assignment to the PropertyGrid
TypeDescriptor. AddAttributes(typeof(MyClass),
    new CategoryOrderAttribute("General", 1),
    new CategoryOrderAttribute("Advanced", 2),
    new CategoryOrderAttribute("Other", 3)
);

Like I said, this doesn't work and the categories still appear in alphabetical order.   Any idea why that doesn't work? 

A:

Turns out there are two bugs in the source.   One, they aren't overriding TypeID in CategoryOrderAttribute, and two, they aren't using TypeDescriptor. GetAttributes.   I've submitted bugs for both...
https://github.com/xceedsoftware/wpftoolkit/issues/1522

