How the RefreshPropertiesAttribute works
Use the RefreshPropertiesAttribute to indicate how a designer
or a databound control refreshes its properties when they are changed. This is
extremely useful for properties whose values should be updated and displayed
when other properties are changed.
Example:
public class Square : Shape
{
private double _length;
public override int NumberOfSides
{
get
{
return 4;
}
}
[Browsable(true)]
[RefreshProperties(RefreshProperties.All)]
public double Length
{
get
{
return _length;
}
set
{
_length = value;
}
}
public override double Area
{
get
{
return _length*_length;
}
}
}
In the example above, whenever the Length property changes, the Area property is automatically
requeried and repainted in the designer and/or PropertyGrid.
Back to Tips and Tricks