title: Progressbar in DataGrid
body: <p>Im trying to add an progress bar to a column like so</p>
  
  <pre><code>&lt;DataGrid Grid.Row="1" ItemsSource="{Binding Locations}" AutoGenerateColumns="false"&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Binding="{Binding Plant}" Header="Plant" /&gt;
          &lt;DataGridTextColumn Binding="{Binding Area}" Header="Area" /&gt;
          &lt;DataGridTextColumn Binding="{Binding LocationName}" Header="Location" /&gt;
          &lt;DataGridTextColumn Binding="{Binding LocationVersion}" Header="Version on location" /&gt;
  
          &lt;DataGridCheckBoxColumn Binding="{Binding Deploy, Mode=TwoWay}" Header="Check to deploy" IsReadOnly="False" /&gt;
          &lt;DataGridTemplateColumn Header="Orders Count" Width="380"&gt;
              &lt;DataGridTemplateColumn.CellTemplate&gt;
                  &lt;DataTemplate&gt;
                      &lt;Grid&gt;
                          &lt;ProgressBar Grid.Row="0" Grid.Column="0"  Minimum="0" Maximum="200" Value="{Binding copyToLocationProgress ,Mode=OneWay}"/&gt;
                      &lt;/Grid&gt;
                  &lt;/DataTemplate&gt;
              &lt;/DataGridTemplateColumn.CellTemplate&gt;
          &lt;/DataGridTemplateColumn&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>This is the ILocation which i'm using:</p>
  
  <pre><code> public interface ILocation
      {
          int LocationId { get; }
  
          string LocationName { get; set; }
  
          string Area { get; set; }
  
          string LocationVersion { get; set; }
  
          int Plant { get; set; }
  
          bool Deploy { get; set; }
  
          string FolderName { get; }
  
          int copyToLocationProgress { get; set; }
      }
  </code></pre>
  
  <p>This is in the ViewModel</p>
  
  <pre><code>public IEnumerable&lt;ILocation&gt; Locations { get; set; }
  </code></pre>
  
  <p>I have also tried it this way </p>
  
  <pre><code> &lt;DataGridTemplateColumn Header="Deploy progress" Width="380"&gt;
                                      &lt;DataGridTemplateColumn.CellTemplate&gt;
                                          &lt;DataTemplate&gt;
                                              &lt;Grid&gt;
                                                  &lt;ProgressBar
                                                      Grid.Row="0"
                                                      Grid.Column="0" 
                                                      Minimum="0"
                                                      Maximum="200" 
                                                      Value="{Binding Path=DataContext.Locations, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}}"/&gt;
                                              &lt;/Grid&gt;
                                          &lt;/DataTemplate&gt;
                                      &lt;/DataGridTemplateColumn.CellTemplate&gt;
                                  &lt;/DataGridTemplateColumn&gt;
  </code></pre>
  
  <p>But this gave me this error:</p>
  
  <blockquote>
    <p>System.Windows.Data Error: 5 : Value produced by BindingExpression is
    not valid for target property.; Value=''
    BindingExpression:Path=DataContext.Locations; DataItem='DataGrid'
    (Name=''); target element is 'ProgressBar' (Name=''); target property
    is 'Value' (type 'Double')</p>
  </blockquote>
  
  <p>But I can't see the value like on the other columns. Because it's databind to a Grid.</p>