Hello Wisej team,
It seems that after version 2.2.29 a behaviour of PropertyGrid has changed a bit. In 2.2.29 and earlier, the type System.Drawing.Color wasn’t expandable, and we successfully redefined its onclick menu with [Editor(typeof(ColorPickerEditor), typeof(UITypeEditor))] attribute. In the latest version (including 2.2.38-rc), all its internal properties, ones that have only getter attribute, which surprised me, are expanded – see screenshot attached.
(in the screenshot [DisplayName(“Background Color”)] is applied to the property)
– Is it a new feature of PropertyGrid or it’s a bug and will be fixed later? If former, how can I disable showing its sub props and make it non-expandable?
Thanks,
Michael
ExpandableObjectConverter expands the object. That is a System.ComponentModel class that has always worked like that. It’s not a Wisej issue.
The issue is ongoing in 2.2.39 as well. Please fix asap or add an option/attribute to behave like it was initailly
The full property looks like this:
[SRCategory(“xyz”)]
[SRDescription(“My Background Color”)]
[DisplayName(“Background Color”)]
[Editor(typeof(ColorPickerEditor), typeof(UITypeEditor))]
[TypeConverter(typeof(ColorTypeConverter))]
public Color BackColor { get; set; }
Whereas ColorTypeContrter looks like:
public class ColorTypeConverter : ExpandableObjectConverter
{
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
if(destinationType == typeof(string))
{
return ((Color)value).Name == “0” ? “” : ((Color)value).Name;
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
It shouldn’t. There was no change related to child properties. They are controlled by the TypeConverter.GetPropertiesSupport() and TypeConverter.GetProperties(). There was a fix where the Wisej.Web.PropertyGrid was calling many TypeConverter methods passing in a null ITypeDescriptorContext.
I tried using both a custom class and a control class but I don’t see the child Color properties. Do you have a custom TypeConverter? Can you reproduce in a small sample?
Please login first to submit.