title: WPF datagrid.rowstyle binding
body: <p>I've got a known error </p>
  
  <p>System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element.BindingExpression:Path=Percent; DataItem=null; target element is 'GradientStop' (HashCode=81530); target property is 'Offset' (type 'Double')</p>
  
  <p>on this part of code :</p>
  
  <pre><code>        &lt;DataGrid.RowStyle&gt;
              &lt;Style TargetType="DataGridRow"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding State}" Value="Started"&gt;
                          &lt;Setter Property="Background"&gt;
                              &lt;Setter.Value&gt;
                                  &lt;LinearGradientBrush EndPoint="1,0" StartPoint="0,0"&gt;
                                      &lt;GradientStop Color="Green" Offset="0" /&gt;
                                      &lt;GradientStop Color="#FF2D2D30" Offset="{Binding Percent}" /&gt;
                                  &lt;/LinearGradientBrush&gt;
                              &lt;/Setter.Value&gt;
                          &lt;/Setter&gt;
                      &lt;/DataTrigger&gt;
                      &lt;Trigger Property="Validation.HasError" Value="true"&gt;
                          &lt;Setter Property="BorderThickness" Value="1"/&gt;
                          &lt;Setter Property="BorderBrush" Value="Red"/&gt;
                      &lt;/Trigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/DataGrid.RowStyle&gt;
  </code></pre>
  
  <p>I've tried to set the <code>DataContext</code> to a proxy but it did not work :</p>
  
  <pre><code>        &lt;DataGrid.Resources&gt;
              &lt;app:BindingProxy x:Key="proxy" Data="{Binding}" /&gt;
          &lt;/DataGrid.Resources&gt;
  
          [...]
          &lt;GradientStop Color="#FF2D2D30" Offset="{Binding Data.Percent, Source={StaticResource proxyRow}}" /&gt;
  </code></pre>
  
  <p>System.Windows.Data Error: 40 : BindingExpression path error: 'Percent' property not found on 'object' ''ViewModel' (HashCode=37637549)'. BindingExpression:Path=Data.Percent; DataItem='BindingProxy' (HashCode=3342738); target element is 'GradientStop' (HashCode=64874797); target property is 'Offset' (type 'Double')</p>
  
  <p>Which is obvious as the Data now contains the DataContext of the Control which is my ViewModel.</p>
  
  <p>Any suggestion ? Thanks !</p>