Advertisement
Monday, September 06, 2010

.net Tips and Tricks

New .net Books!
 
LATEST NEWS

04.11.2005
BlueVision becomes a Microsoft Certified Partner!

03.30.2005

03.01.2005
Two development books get an update for Visual Studio .NET 2003

01.05.2005
BlueVision launches the Community Technology Preview release of CopAlert™, www.copalert.com

12.20.2002
BlueVision in MSDN Magazine
Tips and Tricks

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

Terms Of Use © 2000 - 2010 BLUEVISION LLC. ALL RIGHTS RESERVED. Privacy Policy