fx:Observe markup extension, ${x}

The fx:Observe markup extension observes its source path. It can be used in value supplier and property consumer position:

  1. Value supplier: resolves the source path as an ObservableValue and supplies it to the enclosing construct.
  2. Property consumer: binds the target Property to the ObservableValue identified by the source path.

A leading .. in the source path selects the content of the source collection. In that form, fx:Observe establishes a content binding to the target collection.

Its prefix notation is ${x}, where x is the source path.

Properties

Property Description
path A string that specifies the source path. This is the default property.

Usage

<!-- Element notation -->
<object>
    <property>
        <fx:Observe path="myPath"/>
    </property>
</object>

<!-- Attribute notation -->
<object property="{fx:Observe path=myPath}"/>

<!-- Attribute notation with omitted "path" -->
<object property="{fx:Observe myPath}"/>

<!-- Prefix notation -->
<object property="${myPath}"/>

Usage as a value supplier

When fx:Observe is nested inside another markup extension, it supplies the resulting ObservableValue to the enclosing construct:

<Label text="{DynamicResource message; formatArguments=${amount}}"/>

In this example, ${amount} resolves the amount expression as an ObservableValue, and passes it to the formatArguments parameter of DynamicResource.

Usage as a property consumer

When fx:Observe is applied directly to a property target, it establishes a unidirectional binding on the target property:

<Label text="${title}"/>

This site uses Just the Docs, a documentation theme for Jekyll.