Jump to: navigation, search

Changes


EvalExpression

536 bytes removed, 08:10, 25 January 2021
The following example shows how to evaluate a simple expression without using any parameters and then use the result for visibility binding.
<source lang = "xml">
<StackLayoutxmlns:ctrls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL">
<ctrls:EvalExpression
x:Name="ExpressionEvaluator"
</tabs>
[[Category:Client|EvalExpression]][[Category:Pages with broken file links|EvalExpression]][[Category:WinX|EvalExpression]][[Category:Xamarin|EvalExpression]]
==== Simple Calculation ====
The following example shows how to use the control with three parameters, where the first two are user input (Editor ''Param0'' and ''Param1'') and the third one is a property from its DataContext (ViewModel). The evaluated ''Result'' is then bound to an Label for output in the UI.
<source lang = "xml">
<StackLayout xmlns:ctrls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL">
<Editor x:Name="Expression" Width="200" />
<Editor x:Name="Param0" Width="200" />
</tabs>
[[Category:Client|EvalExpression]][[Category:Pages with broken file links|EvalExpression]][[Category:WinX|EvalExpression]][[Category:Xamarin|EvalExpression]]
==== 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:
<source lang = "xml">
<Grid xmlns:ctrls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL">
<ctrls:EvalExpression x:Name="Evaluator" Expression="&quot;MP_EXAMPLE|&quot; + (P0 + 2)">
<ctrls:EvalExpressionParameter Name="P0" Value="{Binding Values[MP_EXAMPLE], Converter={StaticResource ToType}, ConverterParameter='System.Int32'}" />
</tabs>
[[Category:Client|EvalExpression]][[Category:Pages with broken file links|EvalExpression]][[Category:WinX|EvalExpression]][[Category:Xamarin|EvalExpression]]
== Conditional Statement ==
</tabs>
[[Category:Client|EvalExpression]][[Category:Pages with broken file links|EvalExpression]][[Category:WinX|EvalExpression]][[Category:Xamarin|EvalExpression]]
== Parameters ==