Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
25
xamDataGrid validation problem
posted

Hi,

  I've got a xamdatagrid and am making use of the new IDataErrorInfo stuff for cell validation. The problem scenario I have is that the grid is editable. I want to bind a 'Save' button so that it will be enabled when:

1. The user has changed something.

2. The data in the grid is valid (according to the IDataErrorInfo implementation).

I've done the IDataErrorInfo part and it's working nicely.

I was going to have a 'CanSave' dependency property, with its value based on an 'IsDirty' flag (set in the CellChanged event handler for the grid), combined with the valid state of the grid.

The problem is that when I examine the e.Cell.DataError as below:

        private void dgConfig_CellChanged(object sender, Infragistics.Windows.DataPresenter.Events.CellChangedEventArgs e)
        {
            IsDirty = true;

            if (!string.IsNullOrEmpty((string)e.Cell.DataError))

........

I find that it isn't yet set. Any clues? Am I going about this the wrong way? Can I force the validation? Is there an 'IsValid' property for the xamDataGrid (I couldn't find one).

  Any help would be greatly appreciated.

  Thanks,

    John

PS The validation seems to be called *several* times for the cell.