Is it possible to apply styles programmatically behind the code to individual fields or even to cells?
Currently I'm using a single DataErrorIconStyleKey that I added to the xamDataGrid.Resources.It would be great though if I could set this at a field level depending on the type of data or even when the error is made depending on the type of error.
Please refer to Styling Data Errors document in our online help to achieve this. It walks you through the process of styling data errors in a way that the style and data template will only affect data errors in a specific field.
To do this in code behind you would have to use the CellValuePresenterStyle property exposed by a Field object’s FieldSettings property.
Please let me know if I may be of further assistance.
Many thanks for your help.
Would it be possible for you to send me a quick example of a data error style and this being applied to the CellValuePresenterStyle in code behind?
I tried setting the CellValuePresenterStyle but for me this does not work. The style I used simply replaced any content that should have appeared. It's using the style as the actual content rather than adding it to its resource dictionary I think. Either I'm setting it wrong or there is something wrong with my style template.