New to Telerik UI for WPF? Download free 30-day trial

First Chance 'System.ArgumentException'

PROBLEM

When RadGridView is bound to DataTable.DefaultView, then you may get a first chance exception for an "id" property. Like this one: System.ArgumentException: The type 'DataRowView' does not contain a public property named 'id'.

Similarly, when you are using RadGridView to display a list of DataRowBase objects which implements the ICustomTypeDescriptor, you may also get a first chance exception: System.ArgumentException: The type "DataRowBase" does not contain a public property "RefDate".

CAUSE

Those exceptions come from the poor implementation of the WPF validation - the errors are raised from the Validator.TryValidateObject() method.

SOLUTION

You can set ValidatesOnDataErrors="None" for RadGridView to avoid them.

In case you need to keep the validation, then you can set RadGridView.ValidatesOnDataErrors="InEditMode". Then you will get the exception only when you edit and commit a row.

In this article