Changes
/* Simple Calculation */
The following example shows how to use the control with three parameters, where the first two are user input (Textbox ''Param0'' and ''Param1'') and the third one is a property from its DataContext (ViewModel). The evaluated ''Result'' is then bound to a Textblock for output in the UI.
<source lang = "xml">
<StackPanel StackLayout xmlns:ctrls="usingclr-namespace:UBIK.WinXCPL.Controls" HorizontalAlignment;assembly="Center" Orientation="VerticalUBIK.CPL"> <TextBox Editor x:Name="Expression" Width="200" /> <TextBox Editor x:Name="Param0" Width="20032" /> <TextBox Editor x:Name="Param1" Width="20043" /> <ctrls:EvalExpression x:Name="Evaluator" Expression="{Binding ElementName=Expression, Path=Text, Source={x:Reference Expression}}"> <ctrls:EvalExpressionParameter Name="P0" Value="{Binding ElementName=Param0, Path=TextWidth, ConverterSource={StaticResource ToTypex:Reference Param0}, ConverterParameter='System.Int32'}" /> <ctrls:EvalExpressionParameter Name="P1" Value="{Binding ElementName=Param1, Path=TextWidth, ConverterSource={StaticResource ToTypex:Reference Param1}, ConverterParameter='System.Int32'}" /> <ctrls:EvalExpressionParameter Name="P2" Value="{Binding IsLoggedIn}" />
</ctrls:EvalExpression>
<TextBlock Foreground="White" Label Text="{Binding ElementNamePath=EvaluatorResult, PathSource=Result{x:Reference Evaluator}}" /></StackPanelStackLayout>
</source>
Lets assume that the Textbox ''Param0'' contains a text of 42 and ''Param1'' contains a text of 43. If ''Expression'' now contains <code>(P0 + P1) *2</code> then the result would display 170.
</tabs>
[[Category:Client|EvalExpression]][[Category:Pages with broken file links|EvalExpression]][[Category:WinX|EvalExpression]][[Category:Xamarin|EvalExpression]]
==== Setting a calculated Property Value ====