Localization in WPF PropertyGrid

18 Nov 20181 minute to read

Localization is the process of translating the application resources into different languages for specific cultures. You can localize the WPF PropertyGrid by adding a resource file. The application culture can be changed by setting CurrentUICulture after the InitializeComponent method.

In the below example, the application culture is changed to French.

public MainWindow()
{
    InitializeComponent();
    System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");
}

To localize the PropertyGrid based on CurrentUICulture using resource files, follow the below steps.

Step 1: Create a new folder named Resources in your application.

Step 2: Right-click on the Resources folder, select Add and then NewItem.

Step 3: In Add New Item wizard, select the Resource File option and name the filename as Syncfusion.PropertyGrid.Wpf.<culture name>.resx. For example, you have to give name as Syncfusion.PropertyGrid.Wpf.fr-FR.resx for French culture.

Adding new resource file in WPF application

Step 4: Now, select Add option to add the resource file in Resources folder.

Resource file

Step 5: Add the Name/Value pair in Resource Designer of Syncfusion.PropertyGrid.Wpf.fr-FR.resx file and change its corresponding value to corresponding culture.

Added string property of PropertyGrid which need to localized in resource file

The following screenshot shows the localized PropertyGrid control.

PropertyGrid contain localized today and none button text

View Sample in GitHub