I am trying to implement ICustomTypeDescriptor. I have implemented most of the attributes but I am having problems with EditorAttribute type. Looks like is not recognizing some of my editors, specially the ones I have derived. Since multiline editor and one of the UITypeEditors is working.
I have tested the same class loading it in a property grid and they work just fine, but when I load the same properties in my own implementation some of the EditorAttribute appear to be broken (like showing as simple test) instead of showing the button to select a file for example. Here is my code:
foreach(var property in type.GetProperties()) {
...
foreach(CustomAttributeData attribData in property.GetCustomAttributesData()) {
...
if(attribData.AttributeType == typeof(EditorAttribute)) {
EditorAttribute editorAttr = (EditorAttribute) property.GetCustomAttributes(typeof(EditorAttribute), true).GetValue(0);
converterType = Type.GetType(editorAttr.EditorTypeName); // converterType,
TypeDescriptor.AddAttributes(converterType, new EditorAttribute(editorAttr.EditorTypeName, editorAttr.EditorBaseTypeName));
}
}
...
}
Aucun commentaire:
Enregistrer un commentaire