I want use math operations in XAML code but I dont know how?
In other words, it can perform simple calculations directly in XAML, eliminating the necessity to clutter your view model or write one-off value converters.
The mathematical “operation” refers to calculating a value using operands and a math operator. The symbol of the math operator has predefined rules to be applied to the given operands or numbers.
You can use the eval function to evaluate mathematical expressions in strings.
You mean you want to perform arithmetic operations in xaml?
check out this post (it comes with a sample project)
It allows you to specify code like this:
<TextBlock Height="{Binding ElementName=tb1, Path=ActualHeight,
Converter={StaticResource JScript},
ConverterParameter=Int32.Parse(values[0])/10 *100-110 }" Background="Red"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With