title: How to change background of DataGrid row depending on value in one column
body: <p>I have one DataGrid which contains one column for red or green color image. I do trigger to set red or green color image if status is ERROR or OK which comes from database. I just want to change color for whole row if there is red image.</p>
  
  <p>I do XAML code to set Red of Green Image as below</p>
  
  <pre><code>&lt;DataGridTemplateColumn&gt;
  &lt;DataGridTemplateColumn.CellTemplate&gt;
      &lt;DataTemplate&gt;
          &lt;Image Name="IMG" Source="greenbuzz.png"/&gt;
              &lt;DataTemplate.Triggers&gt;
                  &lt;DataTrigger Binding="{Binding Alarm}" Value="Error"&gt;
                  &lt;Setter TargetName="IMG" Property="Source" Value="redbuzz.png"/&gt;
              &lt;/DataTrigger&gt;             
          &lt;/DataTemplate.Triggers&gt;         
      &lt;/DataTemplate&gt;     
  &lt;/DataGridTemplateColumn.CellTemplate&gt; 
  </code></pre>
  
  <p></p>
  
  <p>And I tried XAML code to change row background color as below</p>
  
  <pre><code>&lt;DataGrid.RowStyle&gt;
      &lt;Style TargetType="DataGridRow"&gt;
          &lt;Style.Triggers&gt;
              &lt;DataTrigger Binding="{Binding Alarm}" Value="ERROR"&gt;
                  &lt;Setter Property="Background" Value="Red" /&gt;
              &lt;/DataTrigger&gt;
          &lt;/Style.Triggers&gt;
      &lt;/Style&gt;
  &lt;/DataGrid.RowStyle&gt;
  </code></pre>
  
  <p>But It did not change background color. Please help me. When I google it I come to know solution about viewmodel and ObservableCollection(); but I have dynamic data which get from database. </p>