title: Avoid filter textox in checkbox column in datagrid in wpf
body: <p>I have one datagrid.The columns header name is binding from one xml file.
  Now I need to add filter text box for header template from datagrid.</p>
  
  <ol>
  <li><p>without textbox filter option the datagrid shown as per the below.
  <a href="https://i.stack.imgur.com/MsXVu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MsXVu.png" alt="enter image description here"></a></p></li>
  <li><p>After adding filter text box the datagrid as shown as below</p></li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/qYv9F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qYv9F.png" alt="enter image description here"></a></p>
  
  <p>I don't want to show textbox in first column i.e checkbox column,how to do this?
  The xaml code is attached below</p>
  
  <pre><code>&lt;UserControl .....&gt;
      &lt;UserControl.Resources&gt;
          &lt;ResourceDictionary&gt;
  
  
              &lt;DataGridTemplateColumn  x:Key="CustomCheckBoxTemplate"&gt;
                  &lt;DataGridTemplateColumn.HeaderTemplate&gt;
                      &lt;DataTemplate &gt;
                          &lt;CheckBox Name="ColumnHearderCheckBox" IsThreeState="True" PreviewMouseLeftButtonDown="OnHeaderCheckBoxMouseButtonDown" /&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.HeaderTemplate &gt;
  
                  &lt;DataGridTemplateColumn.CellTemplate&gt;
                      &lt;DataTemplate&gt;
                          &lt;CheckBox PreviewMouseLeftButtonDown="OnCellCheckBoxPreviewMouseLeftButtonDown" IsChecked="{Binding RelativeSource={RelativeSource FindAncestor,
                                        AncestorType=DataGridRow}, Path=IsSelected,Mode=TwoWay}"/&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/DataGridTemplateColumn.CellTemplate&gt;
  
  
              &lt;/DataGridTemplateColumn &gt;
  
               &lt;ContextMenu x:Key="ColumnHeaderContextMenu"
                  FontSize="{Binding PlacementTarget.FontSize, RelativeSource={RelativeSource Self}}"&gt;
                  &lt;ContextMenu.ItemContainerStyle&gt;
                      &lt;Style TargetType="{x:Type MenuItem}" &gt;
                          &lt;EventSetter Event= "Click" Handler="OnContextMenuItemClicked" /&gt;
                          &lt;Setter Property="IsCheckable" Value="True" /&gt;
                          &lt;Setter Property="Header" Value="{Binding Header}" /&gt;
                          &lt;Style.Triggers&gt;
                              &lt;DataTrigger Binding="{Binding Visibility}" Value="Visible"&gt;
                                  &lt;Setter Property="IsChecked" Value="True"/&gt;
                              &lt;/DataTrigger&gt;
                              &lt;DataTrigger Binding="{Binding Visibility}" Value="Collapsed"&gt;
                                  &lt;Setter Property="IsChecked" Value="False"/&gt;
                              &lt;/DataTrigger&gt;
                              &lt;DataTrigger Binding="{Binding Visibility}" Value="Hidden"&gt;
                                  &lt;Setter Property="IsChecked" Value="False"/&gt;
                              &lt;/DataTrigger&gt;
                          &lt;/Style.Triggers&gt;
                      &lt;/Style&gt;
                  &lt;/ContextMenu.ItemContainerStyle&gt;
              &lt;/ContextMenu&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/UserControl.Resources&gt;
  
      &lt;Grid Margin="5,0,0,0"&gt;
          &lt;Grid.Resources&gt;
              &lt;Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"&gt;
                  &lt;Setter Property="HorizontalContentAlignment" Value="Stretch" /&gt;
                  &lt;Setter Property="Height" Value="30"/&gt;
                  &lt;Setter Property="Foreground" Value="WhiteSmoke"/&gt;
                  &lt;Setter Property="FontSize" Value="14"/&gt;
                  &lt;Setter Property="Template"&gt;
                          &lt;Setter.Value&gt;
                              &lt;ControlTemplate TargetType="{x:Type DataGridColumnHeader}"  &gt;
                                  &lt;Border x:Name="Border"
                               Padding="2"
                               Background="{TemplateBinding Background}"
                               BorderBrush="{TemplateBinding BorderBrush}"
                               BorderThickness="{TemplateBinding BorderThickness}"&gt;
                                      &lt;Grid x:Name="LayoutGrid"&gt;
                                          &lt;Grid.ColumnDefinitions&gt;
                                              &lt;ColumnDefinition Width="*" /&gt;
                                              &lt;ColumnDefinition Width="{Binding RelativeSource={RelativeSource TemplatedParent},
                                                   Path=ActualHeight}" /&gt;
                                          &lt;/Grid.ColumnDefinitions&gt;
                                          &lt;StackPanel Orientation="Vertical"&gt;
                                              &lt;TextBlock Text="{Binding Content, RelativeSource=
                                           {RelativeSource Mode=TemplatedParent}}"/&gt;
                                              &lt;TextBox x:Name="txtId" Width="100"  /&gt;
                                          &lt;/StackPanel&gt;
                                      &lt;/Grid&gt;
                                  &lt;/Border&gt;
                              &lt;/ControlTemplate&gt;
                          &lt;/Setter.Value&gt;
                      &lt;/Setter&gt;
  
              &lt;/Style&gt;
              &lt;DataTemplate x:Key="CustomTemplate"&gt;
                  &lt;StackPanel Orientation="Horizontal" &gt;
                      &lt;Image Source="{Binding Converter={StaticResource StringToImageConverter}}" Height="30" Width="30" Margin="30,0,0,0" HorizontalAlignment="Right"/&gt;
                  &lt;/StackPanel&gt;
              &lt;/DataTemplate&gt;
              &lt;ContextMenu  x:Key="RowMenu" DataContext="{Binding DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"&gt;
                  &lt;MenuItem Header="Delete" Command="{Binding DeleteCommand}" CommandParameter="{Binding SelectedItems, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=DataGrid}}"  &gt;
                  &lt;/MenuItem&gt;
                  &lt;MenuItem Header="Edit" Command="{Binding EditCommand}"/&gt;
              &lt;/ContextMenu&gt;
              &lt;Style x:Key="DefaultRowStyle" TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}"&gt;
                  &lt;Setter Property="ContextMenu" Value="{StaticResource RowMenu}" /&gt;
              &lt;/Style&gt;
          &lt;/Grid.Resources&gt;
          &lt;DataGrid x:Name="dataGrid"  IsReadOnly="True" ItemsSource="{Binding PatientStudyList}"  SelectionMode="{Binding SelectionMode, Converter={StaticResource SelectionModeToStringConverter}}"
                    AlternationCount="2" GridLinesVisibility="Horizontal" AutoGenerateColumns="False"  BorderThickness="1" 
                    RowStyle="{StaticResource DefaultRowStyle}" HorizontalAlignment="Stretch"&gt;
  
              &lt;i:Interaction.Triggers&gt;
                  &lt;i:EventTrigger EventName="Unloaded"&gt;
                      &lt;i:InvokeCommandAction Command="{Binding DataGridUnloadedCommand}"/&gt;
                  &lt;/i:EventTrigger&gt;
              &lt;/i:Interaction.Triggers&gt;
              &lt;DataGrid.ColumnHeaderStyle&gt;
                  &lt;Style TargetType="{x:Type DataGridColumnHeader}" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"&gt;
                      &lt;Setter Property="ContextMenu" Value="{StaticResource ColumnHeaderContextMenu}" /&gt;
                      &lt;Setter Property="Height" Value="50" /&gt;
  
  
                  &lt;/Style&gt;
              &lt;/DataGrid.ColumnHeaderStyle&gt;
          &lt;/DataGrid&gt;
      &lt;/Grid&gt;
  &lt;/UserControl&gt;
  </code></pre>