开发者

WPF validation rule problems in a datagrid

开发者 https://www.devze.com 2023-01-28 15:02 出处:网络
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

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 real开发者_C百科ly 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!


You need to change the default UpdateSourceTrigger property for the ComboBox.

UpdateSourceTrigger=PropertyChanged

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消