Jump to: navigation, search

Changes


EvalExpression

154 bytes removed, 12:46, 7 January 2021
}}
== Usage Concept==
The EvalExpression control allows to evaluate a C# expression from within XAML markup. The ''Expression'' has to be a single-line, valid C# expression ("Lambda") and has to return a single value; expressions can also reference names of subordinate [[EvalExpression#Parameters|EvalExpressionParameter]] items.
=== Examples ===
{{Attention|The namespace used in the following examples is for the UBIK.UWP client. If you are applying them to the UBIK.Xamarin clients, please check the table above for the corresponding namespace.}}
{{Hint|When writing expressions in XAML code, you have to avoid (escape) special characters. There are useful [https://www.freeformatter.com/xml-escape.html online tools] for this.}}
 
<tabs>
<tab name="UWP">
==== Evaluation without parameters ====
</source>
The TextBlock should be visibile visible as long as at least one of the context object's two named properties has a value.
==== Simple Calculation ====
==== Setting a calculated Property Value ====
 
The following example shows how to create a button that adds and stores +5 to the value of a a numeric property named ''MP_EXAMPLE'', every time it is pressed:
== Conditional Statement ==
 
If / Or statements can be evaluated using the C# syntax P0 ? P1 : P2.
In this case, if the result of the P0 expression is True, P1 will be effected. Otherwise, P2 will be.
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.
</tab> <tab name== Usage in "Xamarin ==">
EvalExpressions are also available for usage with Xamarin customisations.
</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.
 
</tab>
</tabs>
==See also==