Hello,
I want to use the IDataErrorInfo interface and the xamdatagrid to show invalid records (rows) not cells. So basically if any business rules are violated, the object's IsValid will be false. When the objects IsValid is false, I want the grid to put a red border around the row. I do NOT want each cell border to be red, but rather I want the whole row to have a red border.
Is there a way to do this?
Thanks,
Jeff
Hello Jeff,
I have been looking into this and even though there is no built-in functionality I was able to modify the original template of the DataRecordPresenter, so you can achieve the desired result. What I had to do was to add a border around the whole record and check the HasDataError property to visualize it. I have put all this in a sample project for you (Grid_IDataError_row_border.zip) and have added comments in the xaml in capital letters only for your reference.
Please let me know if you require any further clarification on the matter.
Petar,
While that does seem to do the trick, it throws an exception in the Visual Studio designer (at least in mine). When I try to view the view in the designer it says "NullReferenceException was thrown on "ControlTemplate": Object reference not set to an instance of an object."
I included a screenshot so you can see it.
If we can clear that up, then I think it will work out for me!!
Thanks for the help!
-Jeff