Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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.

System.Object
   System.Attribute
      System.ComponentModel.AmbientValueAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.All)>
NotInheritable Public Class AmbientValueAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.All)]
public sealed class AmbientValueAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::All)]
public __gc __sealed class AmbientValueAttribute : public
   Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.All)
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.

Remarks

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.

Requirements

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.