My XML data is:
<Num>12.6</Num>
I bind this to a XAML TextBlock and want to display the value as a rounded number without decimal point. So this value should be displayed as 13. Similarly, 12.2 should be displayed as 12, etc.
I need code in the StringFormat below (at the …) to do what I want:
<TextBlock Text= "{Binding Num, StringFormat=...}" />
Thanks.
Try using a converter:
Then in xaml, declare the converter:
And finally use it in the binding, together with the StringFormat:
The zero in
n0indicates no decimal places (Standard Numeric Format Strings)