I have dug deep into the Record.cs source code file and found that the DataRecord class has a property named GetDataErrorInfo that returns the record's DataItem as IDataErrorInfo. However, this fails if the the Record's DataItem is a complex object of objects that support IDataErrorInfo. This complex object is the result of a LINQ to Objects query without a Select "clause" to preserve the ability to set the properties in the Objects used to build the query. Again, these objects in the linq query support IDataErrorInfo. The only way to expose the IDataErrorInfo.Error property is to loop the Cells finding UnboundFields and check if each Field's binding source supports IDataErrorInfo. Is this a bug or will the xamDataGrid never support complex binding? Is there another way to bind to multiple related sources so that I do not have to use UnboundFields and complex binding?
Thank You
Devin
Sorry that I didn't close this. I am content with the wrapper class idea.
Hello Devin,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Hi Devin,
Thank you for the feedback, it is surely noted. I just wanted to point out that I haven’t encountered anyone with a similar issue and perhaps this is why there isn’t a suggested resolution. Regarding using the Entity Framework and Object Relational Mapping it would still result they give you and its particular IDataErrorInfo capabilities.
Please let me know if can be of any further assistance on the matter.
I have considered your response and appreciate the time that you have invested in my question. I will accept the answer of creating a wrapper class, but feel that there should be a better way to handle this situation. Do you have any other suggestions on how to join two or more sources together and display them in a grid? It's just hard for me to accept that this is not an issue for other developers. Is this something that would be solved with me switching to the Entity Framework or some other Object Relational Mapping technique? Again, thank you for all of your time.
I have been looking into your attachment and I do see what is causing you trouble. In order for the XamDataGrid to keep track of the occurred errors in any data object class, the class must inherit from IDataErrorInfo and that way the XamDataGrid can use its errors instance. In your case you have set a query’s result, that returns a bunch of three different types, as DataSource thus depriving the XamDataGrid of data object that inherits from IDataErrorInfo interface. In order to get this working you can try creating a wrapper class that will incorporate your query’s results and in which you would have to create a mechanism that would listen for the properties and sub properties’ errors if they occur.
Hope this helps. Please let me know if I can provide you with any further clarification on the matter.