diff --git a/knowledge-base/datagrid-filtering-ui-customization-keep-only-distinct-values.md b/knowledge-base/datagrid-filtering-ui-customization-keep-only-distinct-values.md new file mode 100644 index 00000000..c22349b0 --- /dev/null +++ b/knowledge-base/datagrid-filtering-ui-customization-keep-only-distinct-values.md @@ -0,0 +1,227 @@ +--- +title: Customizing DataGrid Filtering UI in UI for .NET MAUI +description: Learn how to customize the filtering UI in Telerik DataGrid to remove the filtering criteria and display distinct values checkbox only. +type: how-to +page_title: Modify Filtering UI in Telerik DataGrid for Distinct Values Only +meta_title: Modify Filtering UI in Telerik DataGrid for Distinct Values Only +slug: datagrid-filtering-ui-customization-keep-only-distinct-values +tags: datagrid, ui-for-net-maui, filter, control-template, filtering-ui +res_type: kb +--- + +## Environment + +| Version | Product | Author | +| --- | --- | ---- | +| 11.1.0 | Telerik UI for .NET MAUI DataGrid | [Dobrinka Yordanova](https://www.telerik.com/blogs/author/dobrinka-yordanova) | + +## Description + +I want to customize the filtering UI in the Telerik [DataGrid](https://www.telerik.com/maui-ui/datagrid) in my UI for .NET MAUI application. Specifically, I need to remove the filtering criteria section and display only the distinct values checkbox along with the close and filter buttons. + +This knowledge base article also answers the following questions: +- How to modify the filter control template in Telerik DataGrid? +- How to remove filtering criteria from Telerik DataGrid filtering UI? +- How to display only distinct values in DataGrid filtering UI? + +## Solution + +To modify the filtering UI in Telerik DataGrid, update the filtering control template. Add TelerikTheming to your project and locate the `DataGrid.xaml` file under `TelerikTheming/Styles/Platform`. Use the `DataGridTextFilterControlControlTemplate_Mobile` for mobile or `DataGridTextFilterControlControlTemplate_Desktop` for desktop. + +Follow these steps: + +1. Add TelerikTheming resources to your project. Refer to the [TelerikTheming documentation](https://www.telerik.com/maui-ui/documentation/styling-and-themes/overview). + +2. Open the `DataGrid.xaml` file under `TelerikTheming/Styles/Platform`. Locate the control templates for filtering. + +3. Use the `DataGridTextFilterControlControlTemplate_Mobile` and remove unnecessary parts. Keep only the `DataGridDistinctValuesFilterView`, the close button, and the filter/reset buttons. + +4. Define the updated template in your XAML resources. + +Example: + +```xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +``` + +## See Also + +- [DataGrid Documentation](https://www.telerik.com/maui-ui/documentation/controls/datagrid/overview) +- [TelerikTheming Documentation](https://www.telerik.com/maui-ui/documentation/styling-and-themes/overview) +- [DataGrid Filtering Control Template](https://www.telerik.com/maui-ui/documentation/controls/datagrid/filtering/filter-control-template)