PropertyGrid - Howto refresh?

S

Shmulik

I have a property grid with several items that include derivative effects -
that is if I change the value or item A, then Item B gets changed, as in:


public String ItemA
{
get { return _itemA;}
set { _itemA = value;}
}

public String ItemB
{
get { return _itemB;}
set { _itemB = value;
ItemA = "My new value";
}
}

If I change "ItemB" in the property grid, the changed value for "ItemA" is
not displayed until I click on that field - what do I need to add to the
"ItemB - set()" method to force the propertygrid to show the refreshed
values?
 
S

Shmulik

Thanks! Just what I needed.


Jay B. Harlow said:
Shmulik,
You need to add the System.ComponentModel.RefreshPropertiesAttribute to each
property that effects other properties.

The default for the RefreshPropertiesAttribute is RefreshProperties.None,
you can change it to RefreshProperties.All or RefreshProperties.Repaint.

RefreshProperties.Repaint should work for your properties.

Hope this helps
Jay
 

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