title: How to change the width of column in datagrid in wpf
body: <p>It looks like an easy question, but somehow I can not find the right answer. I have datagrid in wpf in which I want to change the width of columns in c#. The  code is</p>
  
  <pre><code>    DataTable table = new DataTable();
      DataColumn col1 = new DataColumn("From", typeof(string));
      table.Columns.Add(col1);
      table.Columns.Add(new DataColumn("To", typeof(string)));
      table.Columns.Add(new DataColumn("Occurrence", typeof(int)));
  
      dataGrid1.ItemsSource = table.DefaultView;
  </code></pre>
  
  <p>But DataColumn has no width option. How to change the width of column in this case? Thanks. </p>