Is there a way to only validate IDataErrorInfo errors on visible rows on an UltraGrid? When I implement the Error property on a custom object that implements IDataErrorInfo, that property is getting called for every row in the grid when I mouse over the grid. This is fine for a grid with a few dozen rows, but when the grid contains several thousands rows, the grid is unusable. I've provided the implementation of the Error property below. Any ideas?
public virtual string Error
{get { StringBuilder error = new StringBuilder();
var results = new List<ValidationResult>();
bool valid = Validator.TryValidateObject(this, new ValidationContext(this, null, null), results, true);
foreach (ValidationResult result in results) { error.AppendLine(result.ErrorMessage); }
return error.ToString(); } }
I investigated this issue and found that the IDataErrorInfo is not validated on cells which are not in view.
Please take a look at the attached sample, which demonstrates that no cells out of view have their IDataErrorInfo properties accessed. In it, the even rows are filtered out, and the IDataErrorInfo gets within the data class will Debug.WriteLine if accessed. You should see that no such lines are written while the even rows are filtered out.
Further testing showed me that even rows not filtered, but not showing because they would have to be scrolled into view, are not accessed for IDataErrorInfo validation.
There may be some other way your application is accessing the IDataErrorInfo properties, or if you can find some other way that the Grid is accessing them and could send a sample recreating your results I would be happy to investigate into how this is happening.
I have been investigating this case since your response on Friday to find a workaround. My investigation continues, but I want to give you an update to let you know that this is being investigated, and I will give you another update on my progress no later than tomorrow's close of business.
Hello John,
Thanks for your suggestion. Rather than submitting a new product idea and waiting for that to be approved, development, and released, is there another work around you can suggest? I need to limit the number of rows that are being validated, since large numbers of rows make the grid unusable. Any suggestions on ways to limit the number of error validations that occur?
Hello,
After investigating IDataErrorInfo errors and doing some research, limiting to visible rows has been determined to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. You can also link back to this thread for additional details.
Thank you in advance to submitting your product idea.