fx:Evaluate markup extension, $x
The fx:Evaluate markup extension evaluates its source path once. It can be used in value-supplier and property-consumer position:
- Value supplier: evaluates the source path once and supplies the resulting value to the enclosing construct.
- Property consumer: evaluates the source path once and assigns the resulting value to the target property.
A leading .. in the source path selects the content of the source collection. In that form, fx:Evaluate assigns the collection content 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:Evaluate path="myPath"/>
</property>
</object>
<!-- Attribute notation -->
<object property="{fx:Evaluate path=myPath}"/>
<!-- Attribute notation with omitted "path" -->
<object property="{fx:Evaluate myPath}"/>
<!-- Prefix notation -->
<object property="$myPath"/>
Usage as a value supplier
When fx:Evaluate is nested inside another markup extension, it supplies the value of the evaluated expression to the enclosing construct:
<Label text="{StaticResource message; formatArguments=$amount}"/>
In this example, $amount evaluates the amount path once and passes the resulting value to the formatArguments parameter of StaticResource.
Usage as a property consumer
When fx:Evaluate is applied directly to a property, it assigns the evaluated value once and does not keep the property synchronized afterward.
<Label text="$title"/>