title: WPF Changing column width at runtime
body: <p>I have an WPF application that contains a grid. The grid is split into 3 columns with the 3rd grid having zero width upon loading.</p>
  
  <p>I have two datagrids in the other two columns. When the selected item in one of the datagrid changes the other datagrid changes it display values, i.e. a master detail template. This all works fine.</p>
  
  <p>There is one value in the datagrid that if selected I wish this 3rd column to changes its width from zero to 2*. I don't know how to do this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I wish to achieve this through XAML. I have been looking at data triggers &amp; value converters. I written some code below quickly to test. I have read that setting the column to width=0 there is probably higher on the dependency property setting precedence list. Is there anyway to do this or will I need to use code behind?</p>
  
  <pre><code> &lt;Grid&gt;
      &lt;Grid.ColumnDefinitions&gt;
          &lt;ColumnDefinition/&gt;
          &lt;ColumnDefinition Width="2*"/&gt;
          &lt;ColumnDefinition Width="0"/&gt;
      &lt;/Grid.ColumnDefinitions&gt;
  
      &lt;DataGrid Grid.Column="0"
                ItemsSource="{Binding OrderList}"
                SelectedItem="{Binding OrderSelected}"                  
                AutoGenerateColumns="True"&gt;                                    
      &lt;/DataGrid&gt;
  
      &lt;TextBox Grid.Column="1" Text="{Binding OrderSelected.Name}"&gt;
      &lt;/TextBox&gt;
  
      &lt;Grid x:Name="columnHideSeek" Grid.Column="2" Background="Blue"&gt;
          &lt;Grid.Style&gt;
              &lt;Style&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding OrderSelected.Name}" Value="Mark"&gt;
                          &lt;Setter Property="Grid.Width" Value="10"/&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/Style.Triggers&gt;
              &lt;/Style&gt;
          &lt;/Grid.Style&gt;
      &lt;/Grid&gt;
  
  &lt;/Grid&gt;
  </code></pre>