contentStringFormat需要帮助 [英] contentStringFormat help Needed

查看:301
本文介绍了contentStringFormat需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个具有十进制数据类型的字段.
我必须在ListView中显示该字段,但必须将其显示为整数值.

我不想为此写转换器...

Hi to all,

I have One field with Decimal Datatype.
I have to show that field in the ListView but I have to show that as a integer value.

I Don''t want to write converter for that...

Content="{Binding ItemPercentageComplete}"
ContentStringFormat="{}{0:C}"/



我这样尝试过,但仍以十进制数据为例获取数据:
如果ItemPercentageComplete为20.50
我想显示为20.



I tried like this but still am getting data as decimal data example:
if ItemPercentageComplete is 20.50
I want to show that as 20.

推荐答案

使用:{0:C2}.这应该为您工作.有关更多详细信息,您可以阅读标准数字格式字符串 [
Use : {0:C2}. This should work for you. For more details you can read Standard Numeric Format Strings[^]


这篇关于contentStringFormat需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆