title: How to override Datagrid cell style in XAML?
body: <p>I have a style defined in app.xaml as below:</p>
  
  <pre><code>&lt;Style TargetType="DataGridCell"&gt;
          &lt;Setter Property= "BorderThickness" Value="1"/&gt;            
          &lt;Style.Triggers&gt;
              &lt;Trigger Property="IsSelected" Value="True"&gt;
                  &lt;Setter Property="Template"&gt;
                      &lt;Setter.Value&gt;
                          &lt;ControlTemplate TargetType="DataGridCell"&gt;
                              &lt;Grid Height="18"&gt;
                                  &lt;Border BorderBrush="Black" BorderThickness=".2" &gt;
                                      &lt;Border x:Name="border" Background="#992288ff" BorderBrush="Black" BorderThickness=".2"&gt;
                                        ......
                        ......
                    ......
                                      &lt;/Border&gt;
                                  &lt;/Border&gt;
                              &lt;/Grid&gt;
                          &lt;/ControlTemplate&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Trigger&gt;
       &lt;/Style.Triggers&gt;
  </code></pre>
  
  <p></p>
  
  <p>In my form, I have a style defined for one cell. The code is below:</p>
  
  <pre><code> &lt;DataGridTextColumn Width="*" Header="Status" Binding="{Binding Status, Mode=TwoWay}" IsReadOnly="True" &gt;
                      &lt;DataGridTextColumn.CellStyle&gt;
                          &lt;Style TargetType="DataGridCell"&gt;
                              &lt;Setter Property="Foreground"&gt;
                                  &lt;Setter.Value&gt;
                                      &lt;Binding Converter="{StaticResource FGColorKey}"/&gt;
                                  &lt;/Setter.Value&gt;
                              &lt;/Setter&gt;
                          &lt;/Style&gt;
                      &lt;/DataGridTextColumn.CellStyle&gt;
                  &lt;/DataGridTextColumn&gt;
  </code></pre>
  
  <p>Here I am defining only the foreground style only. But the style I defined in the app.xaml for the cell template is not applied for this cell. please see the image attached below:</p>
  
  <p><img src="https://i.stack.imgur.com/oavf7.png" alt="enter image description here"></p>