Localization in .NET MAUI DataGrid (SfDataGrid)
7 Jul 20263 minutes to read
Localization is the process of translating application resources into different languages for specific cultures. The SfDataGrid can be localized by adding resource files. The following strings in SfDataGrid can be localized:
Load MoreClick here to add new rowEqualsDoes Not EqualGreater ThanGreater Than or EqualLess ThanLess Than or EqualBegins WithDoes Not Begin WithEnds WithDoes Not End WithContainsDoes Not ContainBeforeBefore or EqualAfterAfter or EqualEmptyNot EmptyNullNot Null(Blanks)(Select All)OkCancel
Application-Level Localization
To localize the DataGrid based on CurrentUICulture using resource files, follow these steps:
Step-by-step Setup
-
Create a new folder named
Resourcesin the application if it does not already exist. -
Create culture-specific resource files:
- Right-click on the
Resourcesfolder, selectAddand thenNew Item. - In the Add New Item dialog, select the Resource File option and name the filename as
SfDataGrid.<culture name>.resx. For example, useSfDataGrid.fr-FR.resxfor French (France). The culture name format islanguage-country(e.g.,fr-FR,es-ES). - Right-click the newly created file → select
Properties→ setBuild ActiontoEmbeddedResource.


- Right-click on the
-
Add localized strings:
- Open the
SfDataGrid.fr-FR.resxfile and add the Name/Value pairs from the list above, translating values to the target culture. - Use the Resource Designer to add entries (Name column = English string key, Value column = translated string).

- Open the
-
Repeat for additional cultures:
- Create additional
SfDataGrid.<culture name>.resxfiles for each language you want to support (e.g.,SfDataGrid.es-ES.resx,SfDataGrid.de-DE.resx).
- Create additional
Configure CurrentUICulture in App.xaml.cs
Application culture can be changed by setting CurrentUICulture in the App.xaml.cs file during application initialization. The ResourceManager path must match your project’s namespace and folder structure exactly.
using Syncfusion.Maui.DataGrid;
using System.Globalization;
using System.Resources;
namespace MauiDataGridDemo;
public partial class App : Application
{
public App()
{
InitializeComponent();
// Set the application culture (e.g., "fr-FR" for French)
CultureInfo.CurrentUICulture = new CultureInfo("fr-FR");
// Initialize the ResourceManager with your project namespace
// Format: "{ProjectNamespace}.{FolderName}.{ResourceFileName}"
// Replace "MauiDataGridDemo" with your actual project name
SfDataGridResources.ResourceManager = new ResourceManager("MauiDataGridDemo.Resources.SfDataGrid", Application.Current.GetType().Assembly);
MainPage = new MainPage();
}
}Activation and Behavior
After configuration, the DataGrid will use localized strings when the application starts. Localization applies immediately based on the CurrentUICulture set in the App constructor. If a translated string is missing from a culture-specific resource file, the DataGrid will fall back to the neutral culture resource (SfDataGrid.resx) or use the hardcoded English default. Changing the culture at runtime requires reassigning the ResourceManager and may require an application restart for the changes to take effect in all UI elements.
