title: DataGridTextColumn Visibility Binding
body: <p>I'm trying to bind column visibility to that of another element like this:</p>
  
  <pre><code>&lt;Window x:Class="WpfApplication1.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Window.Resources&gt;
      &lt;BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /&gt;
  &lt;/Window.Resources&gt;
  &lt;StackPanel&gt;
      &lt;CheckBox x:Name="chkColumnVisible" Content="Show column" /&gt;
      &lt;DataGrid x:Name="MyDataGrid" AutoGenerateColumns="False"&gt;
          &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn Header="Column1" Visibility="{Binding ElementName=chkColumnVisible, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}"/&gt;
          &lt;/DataGrid.Columns&gt;
      &lt;/DataGrid&gt;
  &lt;/StackPanel&gt;
  </code></pre>
  
  <p></p>
  
  <p>but I get this error in VS output:</p>
  
  <pre><code>System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element. BindingExpression:Path=IsChecked; DataItem=null; target element is 'DataGridTextColumn' (HashCode=48860040); target property is 'Visibility' (type 'Visibility')
  </code></pre>
  
  <p>Is there a pure XAML way to accomplish this?</p>