wpf formatString 中整数的千位分隔符

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18684947/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 09:36:44  来源:igfitidea点击:

thousand separator for integer in formatString

c#wpf

提问by Mahmood Jenami

I want to show the numbers in text block with thousand separator in xaml but without floating point. how can i do it. i tried the following codes:

我想在 xaml 中用千位分隔符显示文本块中的数字,但没有浮点数。我该怎么做。我尝试了以下代码:

StringFormat={}{0:N}

it shows floating point.

它显示浮点数。

StringFormat={}{0:000'.'000}}

it shows 1234 like 001,234 how can it do it?

它显示 1234 像 001,234 怎么办呢?

回答by Hamlet Hakobyan

Use

{Binding StringFormat={}{0:N0}}

The good articleabout formatting in bindings.

关于绑定格式的好文章