问题
My code currently shows like this: 43521 reviews
, I want it be like this: 43,521 reviews
. How can I do that? and is there a full reference for all possible formats in StringFormat
? couldn't find anything. thanks.
<TextBlock Text="{Binding Reviews,StringFormat='{}{0} reviews'}"/>
回答1:
just change your string format like this:
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:0,0} reviews'}"/>
回答2:
This one also worked :)
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:N0} reviews'}"/>
回答3:
Try this:
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:#,0} reviews'}"/>
回答4:
This is what i use for showing comma with 2 decimal precision
<Label Content="{Binding Reviews}" ContentStringFormat="{0:N2} reviews" />
来源:https://stackoverflow.com/questions/22296001/how-to-show-a-comma-separated-number-with-stringformat-in-xaml