Reputation: 353
I have a DataGridCheckBoxColumn in my DataGrid and it's foreColor and BackColor is Black by default in Windows8. While, it is fine in Windows7.
I am getting mad finding a solution about how to change the forecolor of the check mark.
Please help.....
Upvotes: 0
Views: 770
Reputation: 1974
Here is the complete native template for WPF checkboxes.
What your looking for is "GlyphColor" in the "Path.Stroke" in in the following code :
<Path Visibility="Collapsed"
Width="7"
Height="7"
x:Name="CheckMark"
SnapsToDevicePixels="False"
StrokeThickness="2"
Data="M 0 0 L 7 7 M 0 7 L 7 0">
<Path.Stroke>
<SolidColorBrush Color="{DynamicResource GlyphColor}" />
</Path.Stroke>
</Path>
<Path Visibility="Collapsed"
Width="7"
Height="7"
x:Name="InderminateMark"
SnapsToDevicePixels="False"
StrokeThickness="2"
Data="M 0 7 L 7 0">
<Path.Stroke>
<SolidColorBrush Color="{DynamicResource GlyphColor}" />
</Path.Stroke>
</Path>
From here you have at least two solutions :
1) "GlyphColor" is binded as a dynamic resources, that mean that you can change it and it will reflect the change of color immediatly for the mark in the checkbox. BUT, be carreful, it is possible that this resources is used for other controls, so it would change their color too.
2) The brute force solution would be to entirely override the CheckBox style by copy/paste of the above code into your project and to modify only the abovementionned property and replacing it by the color/resource you want.
Upvotes: 2