Jump to: navigation, search

Changes


EvalExpression

236 bytes removed, 11:10, 26 January 2021
==== Evaluation without parameters ====
The following example shows how to evaluate a simple expression without using any parameters and then use the result for visibility binding.
<tabs>
<tab name="UWP">
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">
<StackPanel xmlns:ctrls="using:UBIK.WinX.Controls">
<tab name="Xamarin">
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">
<StackLayout xmlns:ctrls="clr-namespace:UBIK.CPL.Controls;assembly=UBIK.CPL">
</StackLayout>
</source>
The Label should be visible as long as at least one of the context object's two named properties has a value.</tab>
</tabs>
</StackLayout>
</source>
Since Textbox ''P0'' has a width of 32 and ''P1'' has a width of 43. If ''Expression'' now contains <code>(P0 + P1)</code> then the result would display 75.</tab>
</tabs>
==== 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:
<tabs>
<tab name="UWP">
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="using:UBIK.WinX.Controls">
<tab name="Xamarin">
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 + 25)" Context="{Binding}">
<ctrls:EvalExpressionParameter Name="P0" Value="{Binding Values[MP_EXAMPLE]}" />
</ctrls:EvalExpression>
<Button
Text="Tap to add 2 5 more"
Command="{Binding SetPropertyValueAndValidateCommand}"
CommandParameter="{Binding Path=Result, Source={x:Reference Evaluator}}"/>
<tabs>
<tab name="UWP">
If / Or statements can be evaluated using the C# syntax P0 ==true ? P1 : P2.
In this case, if the result of the P0 expression is True, P1 will be effected. Otherwise, P2 will be.
<source lang = "xml">
[[Category:Client|EvalExpression]]
[[Category:Pages with broken file links|EvalExpression]]
[[Category:WinX|EvalExpression]]
[[Category:Xamarin|EvalExpression]]