selectedrow: do not change background color

Jan 16, 2009 at 10:05 AM
Hi

how can I get rid of the default functionality in the datagrid that the selected row will be colored (blue in my case)?

I want to use a style to set the fontweight to bold, which works fine, but how can I accomplish the not-coloring?

BTW: I have alternate rows active

Regards
Klaus
Jan 16, 2009 at 11:07 AM
You should be able to accomplish this by setting the Background property in a DataGridCell template to null based on a trigger condition IsSelected=True. Base it on the upstream DataGridCell template and you should get the behavior you want.

Note that you will also most likely want to set the Foreground property as well. I use SystemColors.WindowTextBrush when creating a trigger/setter in code, and something similar should work in your case.