PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Framework Forms PropertyGrid not updating correctly

Reply

PropertyGrid not updating correctly

 
Thread Tools Rate Thread
Old 21-01-2004, 04:44 PM   #1
Claus Christiansen
Guest
 
Posts: n/a
Default PropertyGrid not updating correctly


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
  Reply With Quote
Old 22-01-2004, 02:41 AM   #2
=?Utf-8?B?SXVsaWFuIElvbmVzY3U=?=
Guest
 
Posts: n/a
Default RE: PropertyGrid not updating correctly

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

  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off