Property Value Class
Reports information about an ambient property, as part of an IAmbientProvider implementation.
public ref class AmbientPropertyValue
public class AmbientPropertyValue
type AmbientPropertyValue = class
Public Class AmbientPropertyValue
AmbientPropertyValue represents an information item that is returned by calling an IAmbientProvider service method. The
GetAll methods return enumerations or arrays of AmbientPropertyValue items; the
GetFirst methods return a single AmbientPropertyValue.
About Ambient Properties
An ambient property is a property whose property value should be available to value converter usage in the XAML node structure and to the object graph underneath it. The ambient concept is relevant for a XAML processor during the object-writing phase of the load path or the serialization phase of a save path.
A type can also be attributed as ambient. In this case, all properties that use the attributed type are reported as ambient.
In the load path case, the ambient property value might influence the object graph produced value of other properties that exist underneath it in a XAML node structure. When processed as a XAML node stream, the ambient concept implies that the ambient property value must be available to type converters and markup extensions from
EndObject. Similarly, a type converter or markup extension that is used for the save path can look up the ambient property and its value. Therefore, the XAML that is produced is a better round-trip representation.
By its language definition, XAML does not specify the order in which members of an object must be processed. However, any ambient property value must be processed first by the XAML reader so that the type converter and markup extension usage that are contained in other properties can access it through the IAmbientProvider service.
DependsOn is a similar concept that also influences XAML node-processing order. However, DependsOn can only be used for peer member and node relationships; it cannot influence all descendants. Also, DependsOn directly influences object graph property setting, whereas the ambient technique relies on type converters or markup extensions. In the ambient technique, there must also be a specific type converter or markup extension definition. It is up to each type converter or markup extension to determine how the ambient property value should be interpreted and applied to the object graph location where the type converter or markup extension is used.
WPF Usage Notes
An ambient property scenario that is illustrated in the WPF feature set is Style.TargetType, which can qualify the necessary property name lookups for other values. In this case, the Style.TargetType value qualifies the Setter.Property values in the XAML nodes underneath it. Setter.Property uses the type converter behavior for a DependencyProperty. This behavior accesses the ambient Style.TargetType value by querying GetFirstAmbientValue from a service context that is available to type converters and markup extensions.
Initializes a new instance of the AmbientPropertyValue class.
Gets the XAML type system identifier (XamlMember) that represents the ambient property.
Gets the value of the ambient property.
Determines whether the specified object is equal to the current object.(Inherited from Object)
Serves as the default hash function.(Inherited from Object)
Gets the Type of the current instance.(Inherited from Object)
Creates a shallow copy of the current Object.(Inherited from Object)
Returns a string that represents the current object.(Inherited from Object)