I need to show double values like: 0.00008 in ListView. Unfortunatelly very often values are represented as exponential/scientific: 1E-8. I don't want users to see 1E-8 type values. I don't know and don't want to know decimal points precision of used doubles. I can't round doubles. I can solve this using c#:
string s = doubleValue.ToString("0.####################"); // gives what I need: 0,00008
How to do exactly same formatting using xaml?
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridView.Columns>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Border>
<Grid>
<TextBlock x:Name="textBlock1" Text="{Binding Path=Profit, StringFormat={{???}}" TextTrimming="CharacterEllipsis" />
</Grid>
</Border>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridView.Columns>
</GridView>
</ListView.View>
Or how to do it using c# to assign such formatting to textBlock1 in code behind?
<TextBlock x:Name="textBlock1"
Text="{Binding Path=Profit,
StringFormat={}{0:0.####################}}"
TextTrimming="CharacterEllipsis" />
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