具有不变文化的双精度数据绑定列表
我碰巧在类中有一个 double 列表,并将其数据绑定到组合框。 我遇到的问题是 double 显示的文本有逗号而不是点。例如 2,56 而不是 2.56。
组合框似乎使用应用程序区域性将我的双精度数转换为字符串,
我不能只将应用程序区域性更改为不变。知道如何强制应用程序中的双打使用不变文化吗?
I happen to have a list of double in a class and databind it to a combobox.
The problem I am experiencing is that the displayed text for double has a comma instead of the dot. Ex 2,56 isntead of 2.56.
The combo box seems to convert my doubles to string using the application culture
I cannot just change the application culture to Invariant. Any idea how I can force doubles in my application to use the invariant culture?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
双打只是数字。他们没有文化。
另一方面,ComboBox 是可以的。您可以使用
ComboBox.FormatInfo
属性来设置它。doubles are just numbers. They do not have a culture.
ComboBox
es, on the other hand, do. You can set it using theComboBox.FormatInfo
property.