If I want to set a cell as data error state, how can I do? It looks there is no way to set the state.
Hello,
I was wondering if you are still looking for a solution for this question? If so, would you clarify what you want to see. Did you want to present an error state in a cell when a WPF Binding Validation fails?
Thank you!
I've spent some time pondering this question. One approach is to create a generic class that takes any data type for its main data field and another property to represent the error state. This way a XamDataGrid CellValuePresenter has something associated with the data to use to trigger the visual error state in the cell. I have attached the solution in a sample project.
The sample declares UnboundFields to communicate how each Field should show the data part of the object in each record and the CellValuePresenter for each Field shows a visual state change triggered off the HasError property. In the sample, the cells with the errors are highlighted with a gray background, a red border and bold text.
I apologize that this solution comes months after your original post. Hopefully, it will prove helpful to you and others.