
I am trying to disable highlighting of cells in a DataGridTemplateColumn of a ThemedDataGrid. My first attempt was to set the background based on the DataGridCell.IsSelected property via Trigger in the Cell style:
<DataGridTemplateColumn CellTemplate="{StaticResource SeparatorCellTemplate}" >
<DataGridTemplateColumn.CellStyle>
<Style TargetType="{x:Type DataGridCell}">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static themes:AssetResourceKeys.ListBackgroundNormalBrushKey}}"/>
</Trigger>
</Style.Triggers>
</Style>
</DataGridTemplateColumn.CellStyle>
</DataGridTemplateColumn>
The style works and the Background property changes when IsSelected is True, but it has no effect - the Cell still highlights blue. I also tried to set the IsFocusable property to False to no effect.
I Snooped the visual tree and found that it is actually the ElementChrome that renders blue as specified by its BackgroundFocused property. I think i have to change the chrome. I can see it as a child of each cell in the grid column in the Snoop visual tree but I have no idea how to do it in code, preferrably in XAML. Are my assumptions correct? Is it possible to conditionally modify the ElementChrome? Is there a cleaner way to do this?
I would love to include a screenshot which I think explains a lot, but I do not know how.
Thank you very much for your assistance.
Marek