title: C# - Changing color of checkmark in checkbox
body: <p>I have a C# application with a tick checkmark when user select the checkbox. The default color is black and not set by anyone. I would like to know the best approach to use to change the color of the checkmark, say to red instead of black.</p>
  
  <p>I can't seem to find which part of the code is responsible for the color change. Tried finding resources online but it requires writing over hundred of lines of XAML just to set the color.</p>
  
  <p>Any suggestion please.</p>
  
  <p>EDIT:</p>
  
  <pre><code>&lt;Setter.Value&gt;
                      &lt;ControlTemplate TargetType="{x:Type CheckBox}"&gt;
                          &lt;Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True"&gt;
                              &lt;Grid.ColumnDefinitions&gt;
                                  &lt;ColumnDefinition Width="Auto"/&gt;
                                  &lt;ColumnDefinition Width="*"/&gt;
                              &lt;/Grid.ColumnDefinitions&gt;
                              &lt;Border x:Name="checkBoxBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="1" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"&gt;
                                  &lt;Grid x:Name="markGrid"&gt;
                                      &lt;Path x:Name="optionMark" Data="F1 M 9.97498,1.22334L 4.6983,9.09834L 4.52164,9.09834L 0,5.19331L 1.27664,3.52165L 4.255,6.08833L 8.33331,1.52588e-005L 9.97498,1.22334 Z " Fill="{StaticResource OptionMark.Static.Glyph}" Margin="1" Opacity="0" Stretch="None"/&gt;
                                      &lt;Rectangle x:Name="indeterminateMark" Fill="{StaticResource OptionMark.Static.Glyph}" Margin="2" Opacity="0"/&gt;
                                  &lt;/Grid&gt;
                              &lt;/Border&gt;
                              &lt;ContentPresenter x:Name="contentPresenter" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/&gt;
                          &lt;/Grid&gt;
                          &lt;ControlTemplate.Triggers&gt;
                              &lt;Trigger Property="HasContent" Value="true"&gt;
                                  &lt;Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}"/&gt;
                                  &lt;Setter Property="Padding" Value="4,-1,0,0"/&gt;
                              &lt;/Trigger&gt;
                              &lt;Trigger Property="IsMouseOver" Value="false"&gt;
                                  &lt;Setter Property="Background" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.MouseOver.Background}"/&gt;
                                  &lt;Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.MouseOver.Border}"/&gt;
                                  &lt;Setter Property="Fill" TargetName="optionMark" Value="{StaticResource OptionMark.MouseOver.Glyph}"/&gt;
                                  &lt;Setter Property="Fill" TargetName="indeterminateMark" Value="{StaticResource OptionMark.MouseOver.Glyph}"/&gt;
                              &lt;/Trigger&gt;
                              &lt;Trigger Property="IsEnabled" Value="false"&gt;
                                  &lt;Setter Property="Background" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.Disabled.Background}"/&gt;
                                  &lt;Setter Property="BorderBrush" TargetName="checkBoxBorder" Value="{StaticResource OptionMark.Disabled.Border}"/&gt;
                                  &lt;Setter Property="Fill" TargetName="optionMark" Value="{StaticResource OptionMark.Disabled.Glyph}"/&gt;
                                  &lt;Setter Property="Fill" TargetName="indeterminateMark" Value="{StaticResource OptionMark.Disabled.Glyph}"/&gt;
                              &lt;/Trigger&gt;
  
                              &lt;Trigger Property="IsChecked" Value="true"&gt;
  
                                  &lt;Setter Property="Opacity" TargetName="optionMark" Value="1" /&gt;
                                  &lt;Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/&gt;
                              &lt;/Trigger&gt;
                              &lt;Trigger Property="IsChecked" Value="{x:Null}" &gt;
                                  &lt;Setter Property="Opacity" TargetName="optionMark" Value="0"/&gt;
                                  &lt;Setter Property="Opacity" TargetName="indeterminateMark" Value="1"/&gt;
                              &lt;/Trigger&gt;
                          &lt;/ControlTemplate.Triggers&gt;
                      &lt;/ControlTemplate&gt;
  </code></pre>