i am using wpf and my problem is in showing float numbers. in general when i bind my data(float number) to a datagrid column it even shows two zero after my rounded number (3.00) but i want to show this two zero just if my value is not rounded. how to solve this problem?
3 -> 3 not 3.00
3.62 -> 3.62
StringFormat is what you need.
<TextBlock Text="{Binding Path=MyFloat, StringFormat='0:0.##'}" />
If this is not work, try '{0:0.##}'
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