views:

265

answers:

2

I'm using DataGrid.RowValidationRules to display error messages in Row Details when the row is not valid.

<c:DataGrid.RowValidationRules>
    <c:RowDataInfoValidationRule ValidationStep="UpdatedValue" />
</c:DataGridx.RowValidationRules>

The model implements IDataErrorInfo and I'm using this ValidationRule:

public class RowDataInfoValidationRule : ValidationRule
{
    public override ValidationResult Validate(object value,
                                              CultureInfo cultureInfo)
    {
        BindingGroup group = (BindingGroup) value;

        StringBuilder error = null;
        foreach (object item in group.Items)
        {
            IDataErrorInfo info = item as IDataErrorInfo;
            if (info == null || string.IsNullOrEmpty(info.Error)) continue;

            if (error == null) error = new StringBuilder();

            error.Append((error.Length != 0 ? ", " : "") + info.Error);
        }

        if (error != null)
            return new ValidationResult(false, error.ToString());

        return ValidationResult.ValidResult;
    }
}

It works pretty well except that I'd like to be able to edit another row even when the current row has validation errors. The validation errors will be, in fact, validation warnings.

How can I do that ? Thanks

A: 

Did you ever find out the solution to this problem? I have exactly the same issue..

Thanks.

bone