This documentation is archived and is not being maintained.

AmbientValueAttribute Class

Specifies the value to pass to a property to cause the property to get its value from another source. This is known as ambience. This class cannot be inherited.

For a list of all members of this type, see AmbientValueAttribute Members.


[Visual Basic]
NotInheritable Public Class AmbientValueAttribute
   Inherits Attribute
public sealed class AmbientValueAttribute : Attribute
public __gc __sealed class AmbientValueAttribute : public
class AmbientValueAttribute extends Attribute

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


If a property on a control has ambient behavior, this attribute must be present. Ambient properties query their parent for their value, for example, a Control.Font property or a Control.BackColor property.

Typically, a visual designer uses the AmbientValueAttribute attribute to decide which value to persist for a property. This is usually a value that causes the property to get its value from another source. An example of an ambient value is Color.Empty as the ambient value for the BackColor property. If you have a control on a form and the BackColor property of the control is set to a different color than the BackColor property of the form, you can reset the BackColor property of the control to that of the form by setting the BackColor of the control to Color.Empty.


Namespace: System.ComponentModel

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: System (in System.dll)

See Also

AmbientValueAttribute Members | System.ComponentModel Namespace