Ola*_*gen 1 .net wpf xaml string-formatting
我需要在XAML中使用String Format格式化数字
12345678901 -> "123456.78901"
2345678901 -> "023456.78901"
Run Code Online (Sandbox Code Playgroud)
当我写写
<TextBox Text="{Binding TheNumber, StringFormat={}{0:000000.00000}}"/>
Run Code Online (Sandbox Code Playgroud)
我最终得到:
12345678901 -> "12345678901.00000"
Run Code Online (Sandbox Code Playgroud)
对于实验,我尝试用空格替换点:
<TextBox Text="{Binding TheNumber, StringFormat={}{0:000000 00000}}"/>
Run Code Online (Sandbox Code Playgroud)
得到:
12345678901 -> "123456 78901"
Run Code Online (Sandbox Code Playgroud)
我想要一个类似于上一个例子的行为,只有一个"点"-speparator而不是"space".
有人只知道如何使用XAML吗?
谢谢!
编辑:我只是认为我需要逃避"点",它经常被视为小数点:
<TextBox Text="{Binding TheNumber, StringFormat={}{0:000000\\.00000}}"/>
Run Code Online (Sandbox Code Playgroud)
试试吧
<TextBox Text="{Binding TheNumber, StringFormat={}{0:000000'.'00000}}"/>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2824 次 |
| 最近记录: |