title: Programmatically setting the width of a grid column with * in WPF
body: <p>I want to programmatically configure a wpf grid. </p>
  
  <p>I want to be able to set a grid with 2 columns, the first taking up 20% of available space, the second taking up 80%. In xaml I would use the * operator but I cant work out how to do this programmatically. </p>
  
  <p>In Xaml I would do:</p>
  
  <pre><code>&lt;Grid&gt;
    &lt;Grid.ColumnDefinitions&gt;
      &lt;ColumnDefinition width="20*" /&gt;
      &lt;ColumnDefinition width="80*" /&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p>In code I want to do:</p>
  
  <pre><code>Grid grid = new Grid();
  grid.ColumnDefinitions.Add( new ColumnDefinition(20*) );
  grid.ColumnDefinitions.Add( new ColumnDefinition(80*) );
  </code></pre>
  
  <p>Please could someone advise. </p>