Applying Dark Theme to RadDataGrid Filtering UI in UI for .NET MAUI
Environment
| Version | Product | Author |
|---|---|---|
| 12.1.0 | Telerik UI for .NET MAUI DataGrid | Dobrinka Yordanova |
Description
When using the default filter in RadDataGrid on a device or app dark theme, the text color changes appropriately, but the background color does not adjust, making the text difficult or impossible to read. If you want to enable proper dark theme behavior for Telerik controls, you need to configure a Telerik dark theme swatch.
This knowledge base article also answers the following questions:
- How to apply Telerik dark theme to DataGrid in UI for .NET MAUI?
- How to configure DataGrid filtering UI for a dark theme?
- How to enable runtime theme changes in UI for .NET MAUI?
Solution
To apply a dark theme to the DataGrid Filtering UI, follow these steps:
-
Enable Telerik theming in your project. Open the
.csprojfile and ensure the Telerik theming mechanism is included.xml<UseTelerikTheming>true</UseTelerikTheming> -
Add the theme resource to the
App.xamlfile. Example:xml<Application.Resources> <ResourceDictionary> <telerik:TelerikTheme x:Key="TelerikTheme" /> </ResourceDictionary> </Application.Resources> -
Set the dark theme swatch in the
App.xaml.csfile. Example:csharppublic App() { InitializeComponent(); if (Application.Current.RequestedTheme == AppTheme.Dark) { TelerikThemeResources.AppTheme = TelerikTheme.PlatformDark; } else TelerikThemeResources.AppTheme = TelerikTheme.PlatformLight; } -
Configure runtime theme changes based on device/app theme. Refer to the detailed guide provided in the Change Telerik Theme at Runtime documentation.
-
For Windows platform, ensure the app dark theme is set properly in
Platforms/Windows/App.xaml.cs. Example:csharpApplication.Current.RequestedTheme = ApplicationTheme.Dark;