CommunityToolkit icon indicating copy to clipboard operation
CommunityToolkit copied to clipboard

Really need more examples on how to use expressions other than the default * / + -

Open Elmigo opened this issue 1 year ago • 2 comments

Really needs more examples of expressions for (Multi)MathExpressionConverter other than the default multiplier(*), divider(/), addition(+) and subtraction(-), I kind of expected "round(x * y)" to work but it's not valid. How do I round numbers, for example, within my XAML binding?

[Enter feedback here]


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

Elmigo avatar Nov 30 '23 14:11 Elmigo

We should provide better examples on what is possible within the MathExpressionConverter for now if you want to use it for rounding I think the following expression should work:

"round(x, 2)" - this will round the value in x to 2 decimal places.

bijington avatar Dec 04 '23 19:12 bijington

We should provide better examples on what is possible within the MathExpressionConverter for now if you want to use it for rounding I think the following expression should work:

"round(x, 2)" - this will round the value in x to 2 decimal places.

Ahh I simply forgot about the decimal places value! Looks like it works after all. Thanks for clarifying! By the way, also thanks for the great book "Introducing .NET MAUI", it is very helpful to get started.

Elmigo avatar Dec 04 '23 20:12 Elmigo