XAML,WPF中的StringFormat:货币格式 [英] StringFormat in XAML, WPF : Currency Formatting

查看:120
本文介绍了XAML,WPF中的StringFormat:货币格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何根据我的国家/地区获取货币格式,即印度卢比,印度卢比或卢比?

How can i obtain currency formatting according to my country i.e indian rupee, INR or Rs ??

请告诉我实现此目标的方法?
现在,当我使用 StringFormat = {} {0:C} 时,正在使用 $

Please tell me the way to achieve this ?? Right now when i use StringFormat="{}{0:C}", "$" is being used

I已通过此链接,我能够达到预期的效果,但是我担心在我的项目中使用它。 此代码安全吗?

I have gone through this link and i am able to achieve the desired result but i am worried about using this in my project. Is this code safe ??

在上面的链接中该行是什么意思?当您测试与设置相关的功能更改时,重要的是,您可以直接从文件夹窗口启动该程序,如果从Visual Studio或任何其他程序中运行该程序,则可能会得到不正确的结果。

What does this line mean in the above link "when you test functionality related to settings change it’s important you start the program directly from a folder window, if you run it from within Visual Studio or any other program you may get incorrect results."

推荐答案

您可以像这样在绑定中指定区域性:

You can specify the culture in your binding like this:

TextBlock Text="{Binding Value, StringFormat=C, ConverterCulture=nl-BE}" 

nl-BE是比利时文化,您可以与印度文化信息交换它,我不知道;-)

nl-BE is belgian culture, you can exchange it with Indian culture info, I don't know that ;-)

这篇关于XAML,WPF中的StringFormat:货币格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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