PropertyGrid - Howto refresh?

  • Thread starter Thread starter Shmulik
  • Start date Start date
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?
 
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
 
Back
Top