数据网格中的 WPF 验证规则问题
我在数据网格中使用验证规则时遇到问题:
我想在 DataGridComboBoxColumn 上使用 ValidationRule,我使用了 这个示例
作为指导,特别是 BindingGroup 的内容。
这在一定程度上有效,但似乎很糟糕。组合框选择更改后,ValidatioRule 不会立即触发,而是仅当我更改选择然后单击 DataGrid 中的另一行时才触发。我真的需要它在我更改组合框的选择后立即触发。
我尝试过扰乱验证步骤,但无济于事,有人可以帮忙吗?
提前致谢!
I'm having a problem using a validation rule in a data grid:
I want to use a ValidationRule on a DataGridComboBoxColumn, I used this example
for guidance, in particular the BindingGroup stuff.
This works to an extent but seems very broken. The ValidatioRule doesn't fire as soon as the combo box selection changes, instead it fires only when I change the selection then click on another row in the DataGrid. I really need it to fire as soon as I have changed the selection of the combo box.
I've tried messing with the validation step but to no avail, can anybody help?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要更改
ComboBox
的默认UpdateSourceTrigger
属性。如果仍然不起作用,请查看此 SO 帖子详细介绍了处理选择更改而不是强制进入模型的方法。
You need to change the default
UpdateSourceTrigger
property for theComboBox
.If that still doesn't work then check out this SO post which details the way to take care of the selection change not being forced into the model.