Download DevExpress v20.1 full version DevExpress v20.1 Chinese resource acquisition
DevExpress Winforms Controls has built-in more than 140 UI controls and libraries, perfect to build smooth, beautiful and easy-to-use applications. Want to experience? Click to download>>
Problems encountered
When a custom editor of a type is added to the PropertyGrid using the DefaultEditors attribute, the editor will be disabled unless the type has an EditorAttribute (the actual type of the editor does not seem to matter).
In DevExpress version 18.1, using the Color extension ColorEditor works normally; but in v19.2, the CustomColor editor is disabled and the CustomColorAttr editor is enabled.
solution
The official technical team fixed this error and changed the operation: PropertyGridControl-The Readonly attribute does not work with a custom editor . The standard DescriptorContext.IsValueEditable method was not considered before, which led to the wrong result. Now use this method correctly in the code.
If you try to assign an object to a standard PropertyGrid, you will get the same result because the DescriptorContext.IsValueEditable method returns false. In turn, this method returns false because the type converter used for the custom class cannot convert the string value to your type. ColorEditor uses ColorConverter that can perform this type of conversion.
Therefore, to enable editing of custom classes, you need to apply a type converter that supports conversion from string values to types.
DevExpress Technical Exchange Group 2: 775869749 Welcome to join the group discussion