title: RadGridView Filtering Control Template
body: <p>I defined a control template to replace the default template of the filtering control on the RadGridView. I am autogenerating columns, how do I apply this custom control template?</p>
  
  <p>My Grid:</p>
  
  <pre><code>&lt;telerik:RadGridView x:Name="dataGrid" telerik:StyleManager.Theme="Windows8Touch" 
                           AutoGenerateColumns="True"  
                           ColumnWidth="200"
                           ShowInsertRow="true"
                           GroupRenderMode="Flat"
                           ValidatesOnDataErrors="InEditMode"
                           AlternationCount="2" 
                           RowHeight="50"
                           ItemsSource="{Binding Path=TemplateData, Mode=TwoWay}" 
                           ShouldRefresh="{Binding Path=Refresh}" 
                           IsReadOnlyBinding="{Binding IsReadOnly}"
                           CloseProgressWhenRendered="True"
                           ShowGroupPanel="False" CanUserSortColumns="False"&gt;
  </code></pre>
  
  <p>My template:</p>
  
  <pre><code>    &lt;ControlTemplate x:Key="FilteringControlTemplate" TargetType="telerik:FilteringControl"&gt;
      &lt;Border BorderThickness="{TemplateBinding BorderThickness}"
              Margin="{TemplateBinding Margin}"
              CornerRadius="1"
              BorderBrush="{TemplateBinding BorderBrush}"&gt;
          &lt;Border BorderBrush="{StaticResource ControlInnerBorder}" BorderThickness="1" Background="{TemplateBinding Background}"&gt;
              &lt;StackPanel MinWidth="200" MaxWidth="350" Margin="{TemplateBinding Padding}"
                          VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                          HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"&gt;
  
                  &lt;TextBlock Foreground="Red" FontSize="18"&gt;Look, I am different ;)&lt;/TextBlock&gt;
  
                  &lt;StackPanel x:Name="PART_DistinctFilter" Visibility="{TemplateBinding DistinctFiltersVisibility}"&gt;
                      &lt;CheckBox x:Name="PART_SelectAllCheckBox"
                                IsChecked="{Binding SelectAll, Mode=TwoWay}"
                                Margin="0,2"
                                telerik:LocalizationManager.ResourceKey="GridViewFilterSelectAll"
                                telerik:StyleManager.Theme="{StaticResource Theme}"/&gt;
  
                      &lt;ListBox x:Name="PART_DistinctValuesList"
                               ItemsSource="{Binding DistinctValues}"
                               telerik:StyleManager.Theme="{StaticResource Theme}"
                               ScrollViewer.HorizontalScrollBarVisibility="Auto"
                               MaxHeight="250"
                               SelectionMode="Multiple"&gt;
  
                          &lt;ListBox.ItemTemplate&gt;
                              &lt;DataTemplate&gt;
                                  &lt;CheckBox IsChecked="{Binding IsActive, Mode=TwoWay}"
                                            Content="{Binding ConvertedValue}"
                                            VerticalContentAlignment="Center"
                                            telerik:StyleManager.Theme="{StaticResource Theme}"/&gt;
                              &lt;/DataTemplate&gt;
                          &lt;/ListBox.ItemTemplate&gt;
                          &lt;ListBox.ItemContainerStyle&gt;
                              &lt;Style TargetType="ListBoxItem"
  
  
                                     BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:Office_BlackTheme, ElementType=ListBoxItem}}"
  
                                     &gt;
                              &lt;/Style&gt;
                          &lt;/ListBox.ItemContainerStyle&gt;
                      &lt;/ListBox&gt;
                  &lt;/StackPanel&gt;
                  &lt;StackPanel Margin="0,2"&gt;
                      &lt;TextBlock telerik:LocalizationManager.ResourceKey="GridViewFilterShowRowsWithValueThat" Margin="0,2,0,0" /&gt;
                      &lt;telerik:RadComboBox x:Name="PART_Filter1ComboBox"
                                         Margin="0,2,0,2"
                                         ItemTemplate="{StaticResource ActionTemplate}"
                                         telerik:StyleManager.Theme="{StaticResource Theme}"
                                         ItemsSource="{Binding AvailableActions}"
                                         SelectedItem="{Binding Filter1.Operator, Mode=TwoWay}" /&gt;
                      &lt;TextBox x:Name="PART_Filter1TextBox"
                               Text="{Binding Filter1.Value, Mode=TwoWay}"
                               VerticalContentAlignment="Center"
                               Margin="0,2" Padding="3,0"
                               telerik:StyleManager.Theme="{StaticResource Theme}"
                               Height="22" /&gt;
                      &lt;CheckBox x:Name="PART_Filter1MatchCaseCheckBox"
                                IsChecked="{Binding Filter1.IsCaseSensitive, Mode=TwoWay}"
                                Visibility="{Binding MatchCaseVisibility}"
                                Margin="0,2"
                                telerik:LocalizationManager.ResourceKey="GridViewFilterMatchCase"
                                telerik:StyleManager.Theme="{StaticResource Theme}"/&gt;
                      &lt;telerik:RadComboBox x:Name="PART_LogicalOperatorsComboBox"
                                         Margin="0,2"
                                         telerik:StyleManager.Theme="{StaticResource Theme}"
                                         ItemTemplate="{StaticResource LogicalOperatorTemplate}"
                                         ItemsSource="{Binding LogicalOperators}"
                                         SelectedItem="{Binding FieldFilterLogicalOperator, Mode=TwoWay}" /&gt;
                      &lt;telerik:RadComboBox x:Name="PART_Filter2ComboBox"
                                         Margin="0,2"
                                         telerik:StyleManager.Theme="{StaticResource Theme}"
                                         ItemTemplate="{StaticResource ActionTemplate}"
                                         ItemsSource="{Binding AvailableActions}"
                                         SelectedItem="{Binding Filter2.Operator, Mode=TwoWay}" /&gt;
                      &lt;TextBox x:Name="PART_Filter2TextBox"
                               Text="{Binding Filter2.Value, Mode=TwoWay}"
                               VerticalContentAlignment="Center"
                               Margin="0,2" Padding="3,0"
                               telerik:StyleManager.Theme="{StaticResource Theme}"
                               Height="22" /&gt;
                      &lt;CheckBox x:Name="PART_Filter2MatchCaseCheckBox"
                                IsChecked="{Binding Filter2.IsCaseSensitive, Mode=TwoWay}"
                                Visibility="{Binding MatchCaseVisibility}"
                                Margin="0,2"
                                telerik:LocalizationManager.ResourceKey="GridViewFilterMatchCase"
                                telerik:StyleManager.Theme="{StaticResource Theme}"/&gt;
                  &lt;/StackPanel&gt;
                  &lt;Grid&gt;
                      &lt;Grid.ColumnDefinitions&gt;
                          &lt;ColumnDefinition /&gt;
                          &lt;ColumnDefinition /&gt;
                      &lt;/Grid.ColumnDefinitions&gt;
                      &lt;Button x:Name="PART_ApplyFilterButton" Grid.Column="0"
                              Margin="0,2,2,2" Height="22"
                              telerik:LocalizationManager.ResourceKey="GridViewFilter"
                              telerik:StyleManager.Theme="{StaticResource Theme}" /&gt;
                      &lt;Button x:Name="PART_ClearFilterButton" Grid.Column="1"
                              Margin="2,2,0,2" Height="22"
                              telerik:LocalizationManager.ResourceKey="GridViewClearFilter"
                              telerik:StyleManager.Theme="{StaticResource Theme}" /&gt;
                  &lt;/Grid&gt;
              &lt;/StackPanel&gt;
          &lt;/Border&gt;
      &lt;/Border&gt;
  
  &lt;/ControlTemplate&gt;
  </code></pre>