我的代码目前显示为这样:43521 reviews
,我想让它变成这样:43,521 reviews
。我该怎么做?还有,是否有关于 StringFormat
的所有可能格式的完整参考?我找不到任何信息。谢谢。
<TextBlock Text="{Binding Reviews,StringFormat='{}{0} reviews'}"/>
我的代码目前显示为这样:43521 reviews
,我想让它变成这样:43,521 reviews
。我该怎么做?还有,是否有关于 StringFormat
的所有可能格式的完整参考?我找不到任何信息。谢谢。
<TextBlock Text="{Binding Reviews,StringFormat='{}{0} reviews'}"/>
这一个也起作用了 :)
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:N0} reviews'}"/>
只需像这样更改您的字符串格式:
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:0,0} reviews'}"/>
试试这个:
<TextBlock Text="{Binding Reviews,StringFormat='{}{0:#,0} reviews'}"/>
下面是我用来显示具有2位小数精度的逗号的方法
<Label Content="{Binding Reviews}" ContentStringFormat="{0:N2} reviews" />