PropertyGrid not updating correctly

C

Claus Christiansen

Hi,

I've made a class containing a public int and a public Point. I also
created a TypeConverter (in fact an ExpandableObjectConverter) supporting
InstanceDescriptorInfo.

This results in a nice expandable property containing the integer
property and an expandable Point property. So far so good.

Further I've found out that in order to inform my control that a sub-
property has been changed then I have to override
GetCreateInstanceSupported and CreateInstance. Now the control catches
the updates.

However:
If I expand the property in the PropertyBrowser like this:

-MyClassProp
- PointProp
X
Y
IntProp

and then enter a new X value and press Enter then the PropertyGrid
somehow gets confused and displays something like this:

-MyClassProp
+ PointProp
IntProp
Y
IntProp

Ie. the Point-property is collapsed but still partially drawn as
expanded! Collapsing and expanding the MyClassProp updates the
PropertyGrid.


My implementation of CreateInstance is pretty simple:
public override object CreateInstance(ITypeDescriptorContext Context,
System.Collections.IDictionary PropertyValues)
{
Point p = (Point)PropertyValues["PointProp"];
MyClassProp mcp = new MyClassProp((int)PropertyValues["IntProp"], p);

return mcp;
}

What am I doing wrong? Or is this a bug in the PropertyGrid?

Regards
/Claus
 
G

Guest

Hi,

try to put this attribute to both properties:

[RefreshProperties(RefreshProperties.All)]

This should force the properties to be requeried and the view redrawn...

regards,
iulian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top