Jump to: navigation, search

Changes


EvalExpression

536 bytes removed, 13:52, 7 January 2021
<tab name="Xamarin">
 
</tab>
</tabs>
<tab name="Xamarin">
{{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 <b>Context="{Binding}"</b> is required for the expression to function in 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.
</tab>
</tabs>
<tab name="Xamarin">
 
</tab>
</tabs>
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.
 
<tabs>
<tab name="UWP">
</tab>
If / Or statements are being evaluated using the C# syntax (P0==0 || P0==null) ? P1 : P2.
In this case, if the result of the P0 expression is zero or null, P1 will be effected. Otherwise, P2 will be.
<tab name="Xamarin">
<Controls:EvalExpression x:Name="WFcolors_Issued" Expression="(P0==0 || P0==null) ? P1 : P2">
<Controls:EvalExpressionParameter Name="P0" Value="{Binding Values[SC_STATUS]}" />
<Controls:EvalExpressionParameter Name="P1" Value="LightGray" />
<Controls:EvalExpressionParameter Name="P2" Value="{StaticResource MATAP_Priority_Green}" />
</Controls:EvalExpression>
</tab>
</tabs>
== 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.
<tabs>
<tab name="UWP">
</tab>
 
<tab name="Xamarin">
</tab>
</tabs>
 
EvalExpressions are also available for usage with Xamarin customisations.
 
 
 
 
 
 
 
 
 
==See also==