title: Get current Rendered width of Grid column Wpf
body: <p>I have a <code>Grid</code> that has some column defined and Column width is also defined in <code>xaml</code>.</p>
  
  <pre><code>&lt;Border Grid.Row="2" BorderThickness="2" BorderBrush="#001732"
          Width="{Binding ActualWidth, ElementName=ParentContainer}"&gt;
      &lt;Grid Name="DataGrid" Width="{Binding ActualWidth, ElementName=ParentContainer}"
            Style="{StaticResource GridStyle}"&gt;
  
                      &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                          &lt;ColumnDefinition Width="50*" /&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
       &lt;/Grid&gt;
  &lt;/Border&gt;
  </code></pre>
  
  <p>now if i change the size of window the column width changes automatically. and i am trying to get the changed latest width with this code.  </p>
  
  <pre><code>public void CoulmnWidthSetter()
  {
      _columnWidth = DataGrid.ColumnDefinitions[4].Width.Value;
      foreach (var col in DataGrid.ColumnDefinitions)
      {
  
          _totalColumnsWidth = _totalColumnsWidth + col.Width.Value;
      }
  }  
  </code></pre>
  
  <p>and calling the Column width setter method in below Event.  </p>
  
  <pre><code>private void ParentContainer_OnSizeChanged(object sender, SizeChangedEventArgs e)
      {
          CoulmnWidthSetter();
      } 
  </code></pre>
  
  <p>or i have tried to call this method in Window size changed event also. But still it always give me that hard coded <code>50</code> width value why ?</p>