I have a TextBlock
element and a Quantity (int) property.
I want to convert the value to a string.
The conversion must be like this:
Quantity == 0 ? "" : Quantity
I'm trying to use the CalcBinding extension, but I wasn't able to write the expression with the correct syntax.
<TextBlock TextWrapping="Wrap" Text="{c:Binding '(Quantity == 0 ? "" : Quantity)'}"
Margin="-32,0,0,0" Height="16"
HorizontalAlignment="Center" />
The above doesn't work.
I think that the quotes are my problem, but I don't know how to fix it.
For those who still wants to know the solution, here it is: