System.ComponentModel.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.

See Also: AmbientValueAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.All)]
public sealed class AmbientValueAttribute : Attribute

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 System.Windows.Forms.Control.Font property or a System.Windows.Forms.Control.BackColor property.

Typically, a visual designer uses the System.ComponentModel.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 System.Drawing.Color.Empty as the ambient value for the System.Windows.Forms.Control.BackColor property. If you have a control on a form and the System.Windows.Forms.Control.BackColor property of the control is set to a different color than the System.Windows.Forms.Control.BackColor property of the form, you can reset the System.Windows.Forms.Control.BackColor property of the control to that of the form by setting the System.Windows.Forms.Control.BackColor of the control to System.Drawing.Color.Empty.

Requirements

Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0, 2.0.0.0, 4.0.0.0