title: how to change the foreground of the datagrid textblock column using binding
body: <p>In my application, I have used "DataGrid" to bind set of values dynamically. Also based upon the values binded, I need to change the forecolor of the values binded.</p>
  
  <p>Here is my XAML and C# code</p>
  
  <p>XAML:</p>
  
  <hr>
  
  <p><br>
                                                             </p>
  
  <pre><code>                            &lt;my:DataGridTemplateColumn Header="Priority"&gt;
                                  &lt;my:DataGridTemplateColumn.CellTemplate&gt;
                                      &lt;DataTemplate&gt;
                                          &lt;TextBlock HorizontalAlignment="Left" Name="txtPriority" Text="{Binding MessagePriority}" FontWeight="Bold"&gt;  
                                            &lt;TextBlock.Resources&gt;
                                              &lt;Style TargetType="TextBlock"&gt;
                                                  &lt;Setter Property="Foreground" Value="{Binding ForegroundBrush}" /&gt;
                                              &lt;/Style&gt;
                                          &lt;/TextBlock.Resources&gt;
                                          &lt;/TextBlock&gt;
  
                          &lt;/my:DataGrid.Columns&gt;                            
  
                      &lt;/my:DataGrid&gt;
  </code></pre>
  
  <p>C#:</p>
  
  <hr>
  
  <pre><code>private SolidColorBrush _foregroundBrush;
  
          public SolidColorBrush ForegroundBrush
          { 
              get
              {
                  return _foregroundBrush;
              }
              set
              {
                  if (_foregroundBrush != value)
                  {
                      _foregroundBrush = value;
                      RaisePropertyChanged(() =&gt; _foregroundBrush);
                  }
              }
          }
  
  var color = (Color)ColorConverter.ConvertFromString("#FF00FF");
                                      var brush = new SolidColorBrush(color);
                                      ForegroundBrush = brush;  
  </code></pre>