title: Shrinking the width of a column in WPF for DataGrid
body: <p>My first row looks something like this:</p>
  
  <pre><code>Title 1 2 3 4 5 6 7 ...
  </code></pre>
  
  <p>If I choose </p>
  
  <pre><code>ColumnWidth="Auto"
  </code></pre>
  
  <p>it sizes it correctly, but there is too much space between the columns.  Is there a way to shrink that? I tried in the code behind my xaml where I get the data to do</p>
  
  <pre><code>if (textColumn != 0) {
  textColumn.Width = 8;
  }
  </code></pre>
  
  <p>or something along those lines, but the size doesn't seem to change.  I'm not sure if this is correct as I'm new to WPF and C#.  Thanks.</p>
  
  <p>Edit:</p>
  
  <p>XAML:</p>
  
  <pre><code>&lt;DataGrid x:Name="dtGridReads"  AutoGenerateColumns="False" 
          VirtualizingStackPanel.IsVirtualizing="True"                                       
          VirtualizingStackPanel.VirtualizationMode ="Standard"
            EnableColumnVirtualization="True"
            EnableRowVirtualization="True"
          ScrollViewer.IsDeferredScrollingEnabled="True"
          CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="True"
           ItemsSource ="{Binding}" Block.TextAlignment="Center"
           AlternatingRowBackground="LightGoldenrodYellow" RowBackground="White"
            CanUserAddRows="False" CanUserDeleteRows="False" FrozenColumnCount="1"
             GridLinesVisibility="None" Style="{StaticResource ConcensusDataGridStyle}" FontSize="12" &gt;
  &lt;/DataGrid&gt;
  </code></pre>