title: WPF trigger on datagrid to hide/show columns according to bindings
body: <p>I have a data grid like this:</p>
  
  <pre><code>&lt;DataGrid AutoGenerateColumns="False" CanUserDeleteRows="True"
            HorizontalScrollBarVisibility="Hidden" Margin="10,10,10,10" 
            VerticalScrollBarVisibility="Visible" 
            CanUserAddRows="False" ItemsSource="{Binding ListGestores}"
            ToolTip="Selecione uma linha e pressione DELETE para remover uma unidade."&gt;
      &lt;DataGrid.Columns&gt;
          &lt;DataGridTextColumn Binding="{Binding TB_UNIDADE.DS_NOME_UNIDADE}" CanUserResize="False" Header="Setor" IsReadOnly="True" x:Name=""/&gt;
          &lt;DataGridTextColumn Binding="{Binding TB_UNIDADE.TB_UNIDADE2.DS_NOME_UNIDADE}" CanUserResize="False" Header="Unidade" IsReadOnly="True" x:Name=""/&gt;
          &lt;DataGridTextColumn Binding="{Binding TB_CONTATOS.DS_NOME}" CanUserResize="False" Header="Gestor" IsReadOnly="True" /&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  </code></pre>
  
  <p>The problem is that i need to verify if the 2 column binding is null, and if it is null, i need to Hide it, and Change the Header of the column 1.</p>
  
  <p>I know that i can do that with Triggers, but how exactly???
  I started with:</p>
  
  <pre><code>&lt;DataGrid.Triggers&gt;
      &lt;DataTrigger Binding="{Binding TB_UNIDADE.TB_UNIDADE2}" Value="{x:Null}"&gt;
          &lt;Setter Property="" Value="" /&gt;
      &lt;/DataTrigger&gt;
  &lt;/DataGrid.Triggers&gt;
  </code></pre>
  
  <p>But i don't know what setter or whatever to put !</p>
  
  <p>Help me =]</p>