Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
xamDataGrid and Row Validation
posted

I'm trying to validate the objects being added to the datasource (an BinidngList<T>). I'm doing this in "RecordUpdating" event and set the "Action" to "CancelUpdateRetainChanges" to keep the changes and don't let the data get added to the collection. It is all working fine.

Now I need to tell the user which column value is not valid. I have two solutions on mind:

- Change the border color of the editors with invalid values to red.
- Add an Errro Icon to "row header" (where ">" icon is displayed) and add a message to the icon's tooltip.

But it seems that I can not  do the first one because in "RecordUpdating" event I don't have access to all the editors (or row background), also in "EditModeEnded" event, I just have the access to a single column's editor that is being actually edited, not the other columns.

Also, I'm not sure how to change / add an icon to the row header.

Any help is appreciated.

  • 69686
    Suggested Answer
    posted

    Hello,

    You have access to everything that you need in these events.

    The CellValuePresenter is the visual representation of the cell. So, in order to make some styling on a cell, you need the CellValuePresenter rather than the editor. You can get an instance of the CellValuePresenter by the static method:

    CellValuePresenter.FromCell(...) or CellValuePresenter.FromRecordAndField(...);

    Regarding the icon, you would have to retemplate the RecordSelector and put it there.

    You can see te default styles for these two elements in the DefaultStyles directory in the Infragistics folder on your computer. You can also see example of retemplating/restyling in the XamFeatureBrowser, which is installed with our products.

    Please let me know if you have any questions on this matter.