I have a style set in my app.config that I want to colour every rectangle I use in my program. It's nice and simple, it looks like this;
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="LightBlue"/>
</Style>
I noticed some weird behaviour in all of my DataGrids recently in that when the user navigated through the rows using the arrow keys, the text inside the cell would be blanked out, it looks like this;
BEFORE
AFTER ARROWKEYS PRESSED
As you can see the text is quite clearly gone (that's the same cell in both images). I finally got round to looking at this and came to the conclusion that the rectangle style is applying to each DataGridCell. I can only assume that that is because wpf uses recangles in a DataGridCell.
Is there a way I can apply this style to only the rectangles that I have taken out of the toolbox and not the literal rectangles in the DataGrid?
An easy option out of this is to remove the style completely and individually apply it, but if we change the colour scheme further down the line this could become very time consuming.
UPDATED
I'd also (if possible) like to use any fix in conjuction with modifying my DataGridCell appearance which I do like so;
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Orange" />
<Setter Property="BorderBrush" Value="Black" />
</Trigger>
</Style.Triggers>
</Style>

