C# ICustomTypeDescriptor和XAML序列化

C# ICustomTypeDescriptor和XAML序列化,c#,.net,wpf,xaml,customtypedescriptor,C#,.net,Wpf,Xaml,Customtypedescriptor,我有一个可以通过PropertyGrid编辑的业务对象。它包含标签列表(比如字符串以简化) 标签列表是从列表继承的简单类: public class LabelsList : List<T> {} 生成的xaml如下所示(原语是我的对象自定义类型的名称): 我们仍然需要让这一切顺利进行。也许测试项目将有助于了解我在寻找什么: 重构初始业务对象,序列化/反序列化现在自动完成,工作正常。这有帮助吗?我想不是。问题不在于特殊字符(例如,我可以在标签中使用空格),而在于生成的XAML结构本

我有一个可以通过PropertyGrid编辑的业务对象。它包含标签列表(比如字符串以简化)

标签列表是从列表继承的简单类:

public class LabelsList : List<T>
{}
生成的xaml如下所示(原语是我的对象自定义类型的名称):

我们仍然需要让这一切顺利进行。也许测试项目将有助于了解我在寻找什么:

重构初始业务对象,序列化/反序列化现在自动完成,工作正常。

这有帮助吗?我想不是。问题不在于特殊字符(例如,我可以在标签中使用空格),而在于生成的XAML结构本身。现在尝试使用自定义XamlWriter,仍然没有成功。
public class LabelsList : List<T>
{}
public PropertyDescriptorCollection GetProperties()
{
    var props = new PropertyDescriptorCollection(null);
    for (var i = 0; i < this.Count; i++)
    {            
        var descriptor = new LabelsListPropertyDescriptor(this, i);
        props.Add(descriptor);
    }
    return props;
}
<wpfdl:LabelsList>
    *<wpfdl:LabelsList.Label1Name>*
        <wpfdl:Label LabelText="Label1Name"/>
    *</wpfdl:LabelsList.Label1Name>*
...
</wpfdl:LabelsList>
public override bool ShouldSerializeValue(object component)
{
    return false;
}
<Primitive>
    <Primitive.Labels>
        <Label LabelText="text1" LabelPosition="position1" />
        <Label LabelText="text2" LabelPosition="position2" />
    </Primitive.Labels>
</Primitive>
'Collection property 'WPF_DrawingsTest.Primitive'.'Labels' is null.' Line number '1' and line position '96'.