Jump to: navigation, search

Changes


EvalExpression

1,081 bytes added, 10:52, 20 November 2020
== Parameters ==
EvalExpressionParameters can be added as child objects to an EvalExpression control. Each parameter object needs a unique ''Name'' and a ''Value'', where the latter can be either a constant or dynamic value supplied through a binding.
 
== Usage in Xamarin ==
EvalExpressions are also available for usage with Xamarin customisations.
 
{{Attention|Note that extra syntax is required to get the EvalExpression to work in Xamarin!}
 
<source lang = "xml">
xmlns:controls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL"
...
<controls:EvalExpression x:Name="UppercaseTitle" Expression="(P1.ToUpper())" Context="{Binding}">
<controls:EvalExpressionParameter Name="P1" Value="{Binding PropertyItem.MetaProperty.Description}" />
</controls:EvalExpression>
</source>
 
The above example converts a text (in this situation, the Description text of a property) to a capitalised version. Note that the text Context="{Binding}" is required for the expression to function on Xamarin.
 
To output the result of your expression, use the following syntax:
<source lang = "xml">
<Label Text="{Binding Path=Result, Source={x:Reference UppercaseTitle}}" />
</source>
Note that the correct way to reference elements in Xamarin is x:Reference (ie. the UWP equivalent of ElementName=), followed by the name given to your EvalExpression.
==See also==
511
edits