New to Telerik UI for WPF? Download free 30-day trial

Hiding the Field Filters in RadGridView Popup Filter Control

Environment

Property Value
Product RadGridView for WPF

Description

How to remove the field filters in the FilteringControl shown in the RadGridView's column filter popup.

Solution 1

To hide the two field filters, set the ShowFieldFilters property of the GridView column to false.

<telerik:GridViewDataColumn ShowFieldFilters="False" /> 

Solution 2

To hide only one of the filters, use the Loaded event of the FilteringControl in order to access the corresponding visual elements. Then, set their Visibility to Collapsed.

static MainWindow() 
{ 
    EventManager.RegisterClassHandler(typeof(FilteringControl), FilteringControl.LoadedEvent, new RoutedEventHandler(OnFilteringControlLoaded)); 
} 
 
private static void OnFilteringControlLoaded(object sender, RoutedEventArgs e) 
{ 
    var filteringControl = (FilteringControl)sender; 
    var comboBoxes = filteringControl.ChildrenOfType<RadComboBox>(); 
 
    var logicalOperatorComboBox = comboBoxes.FirstOrDefault(x => x.Name == "PART_LogicalOperatorsComboBox"); 
    if (logicalOperatorComboBox != null) 
    { 
        logicalOperatorComboBox.Visibility = Visibility.Collapsed; 
    } 
 
    var filter2ComboBox = comboBoxes.FirstOrDefault(x => x.Name == "PART_Filter2ComboBox"); 
    if (filter2ComboBox != null) 
    { 
        filter2ComboBox.Visibility = Visibility.Collapsed; 
    } 
 
    var filter2Editor = filteringControl.ChildrenOfType<ContentControl>().FirstOrDefault(x => x.Name == "PART_Filter2ContentControl"); 
    if (filter2Editor != null) 
    { 
        filter2Editor.Visibility = Visibility.Collapsed; 
    } 
} 
In this article