WPF DataGridTextColumn无法为浮点数据键入点 [英] WPF DataGridTextColumn Can't type point for float data

查看:114
本文介绍了WPF DataGridTextColumn无法为浮点数据键入点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF DataGrid,并使用DataGridTextColumn绑定到集合。集合中的项目具有一些float属性。

I had a WPF DataGrid and use DataGridTextColumn Binding to a Collection. The items in Collection had some float property.

在程序启动时,我修改了DataGrid中的float属性的值,如果键入整数值,则效果很好。但是如果我输入char。对于浮点值,char。无法输入。我必须先键入所有数字,然后再跳到。键入char的位置。完成输入。

When my program launched, I modify the value of float property in DataGrid, if I type a integer value, it works well. But if I type char . for a float value, char . can't be typed. I had to type all the numbers first, and then jump to the . position to type char . to finish my input.

那么我该如何输入。

谢谢。

推荐答案

也遇到了同样的问题问题。

Also met the same problem.

对于我来说,这是由于数据绑定选项所致。

For my case, it is due to the data binding options.

我从<$ c $更改为c> *。UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; 到 *。UpdateSourceTrigger = UpdateSourceTrigger.LostFocus;

然后可以直接输入 float 数字。

Then it can type float number directly.

这篇关于WPF DataGridTextColumn无法为浮点数据键入点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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