There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
AlternatingRowBackground Causes Ignoring of Row Background Triggers
Because AlternatingRowBackground is a property transferred from the DataGrid and is not present on the DataGridRow itself, when set, it causes the chosen alternate background color to be set on a row regardless of what other triggers might be setting Background
to on the row. It looks like this is because when the AlternatingRowBackground property is set, the background properly on the row itself, even if set, is ignored. This looks to be due to how DataGridHelper.GetCoercedTransferPropertyValue is used to transfer
the value from the parent grid if it is set. I can see both where this would be the right behavior, and where it might be the wrong behavior.
The workaround that I have found for myself is to not use AlternatingRowBackground but instead set AlternationCount (this seemed necessary, or else AlternationIndex will not be set) and then have my local styles trigger based on that value. The part that makes
this tricky to maintain is that in the various instances of the grid, different properties cause different background colors, and so the trigger logic is quite a bit more complicated by having to handle this extra case. What would be ideal in my case (but
again, perhaps not in all cases) would be if explicit setting of the Background property on the DataGridRow took precedence over the parent grid's AlternatingRowBackground or RowBackground properties.