类别在Xceed PropertyGrid中订购

Ska*_*jit 1 c# wpf propertygrid wpftoolkit xceed

我正在使用Xceed的PropertyGrid来显示某些元素的特征.元素有不同的类别,如:General,Advanced,Others,Special.在这里,我发现Xceed的propertygrid按字母顺序对类别和属性进行排序.我能够通过使用来对类别内的属性进行排序[PropertyOrder(n)].我也想对类别进行排序,我尝试使用CategoryOrder类似[CategoryOrder("General", 0)]但它显示以下错误:

错误2属性"CategoryOrder"在此声明类型上无效.它仅对"类"声明有效.

我用错了吗?下面提供的代码只是一个示例,以显示我如何使用它.

[Category("General")]
[CategoryOrder("General", 0)]
[DisplayName("XValue")]
[Description("Value of X-Coordinate")]
[ReadOnly(true)]
[PropertyOrder(1)]

[Category("Advanced")]
[CategoryOrder("Advanced", 1)]
[DisplayName("Collision")]
[Description("Collision")]
[ReadOnly(true)]
[PropertyOrder(1)]

[Category("Others")]
[CategoryOrder("Others", 3)]
[DisplayName("Traffic")]
[Description("Traffic at a point")]
[ReadOnly(true)]
[PropertyOrder(1)]

[Category("Special")]
[CategoryOrder("Special", 2)]
[DisplayName("Special cases")]
[Description("Contains the special cases and files")]
[PropertyOrder(1)]
Run Code Online (Sandbox Code Playgroud)

jsa*_*ics 6

以下是如何使用它的示例:

[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; }
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述