Skip to content

Commit 996fb4a

Browse files
authored
Merge pull request #1 from SyncfusionExamples/ES-975464
ES-975464 - Resolve the ReadMe file length issue in this sample repository
2 parents 410d38f + bb3b32b commit 996fb4a

File tree

6 files changed

+56
-4
lines changed

6 files changed

+56
-4
lines changed

AddingCustomResourceFile.png

57.1 KB
Loading

CustomResourceFile.png

25.9 KB
Loading

DefaultResourceFile.png

24.4 KB
Loading

LocalizationAppliedToDataGrid.png

59.1 KB
Loading

README.md

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,58 @@
1-
# Localization in WPF DataGrid (SfDataGrid)
1+
# How to Apply the Localization in WPF DataGrid?
22

3-
This repository contains sample which shows localization of Syncfusion WPF DataGrid.
4-
https://help.syncfusion.com/wpf/localization
3+
This repository contains sample which shows localization of Syncfusion [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid) (SfDataGrid).
54

6-
![Localized WPF DataGrid](wpf-datagrid-localization.PNG)
5+
[Localization](https://help.syncfusion.com/wpf/localization) is the process of translating the application resources into different language for the specific cultures. You can localize the WPF DataGrid by adding a resource file for each language.
6+
7+
### Changing application culture
8+
9+
When you change the application culture, you can localize the application based on application culture by creating .resx file.
10+
11+
#### C#
12+
13+
``` csharp
14+
public partial class MainWindow
15+
{
16+
public MainWindow()
17+
{
18+
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de");
19+
InitializeComponent();
20+
}
21+
}
22+
```
23+
24+
#### VB
25+
26+
``` vb
27+
Partial Public Class MainWindow
28+
Public Sub New()
29+
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("de")
30+
InitializeComponent()
31+
End Sub
32+
End Class
33+
```
34+
35+
### Creating .resx files
36+
37+
You can create .resx files for any language by following these steps:
38+
39+
1. Right-click your project and add a new folder named as `Resources`.
40+
41+
2. Add the [default resource files](https://github.com/syncfusion/wpf-controls-localization-resx-files) to the libraries you are using to the `Resources` folder and ensure `AccessModifier` is specified as Public.
42+
43+
**Note:**
44+
Consider, you are using `SfDataGrid` and `Ribbon` in your application. Then, you need to copy and include `Syncfusion.SfGrid.WPF.resx` (since `SfDataGrid` present in `Syncfusion.SfGrid.WPF` library) and `Syncfusion.Tools.Wpf.resx` (since `Ribbon` present in `Syncfusion.Tools.WPF` library) files in your application under `Resources` folder. So, now you can know the key names and values of default stings used in `Syncfusion.Tools.WPF.dll` and `Syncfusion.SfGrid.WPF.dll` libraries.
45+
46+
![Included the default resource file for localization](DefaultResourceFile.png)
47+
48+
3. Now, right-click `Resources` folder and select Add and then `NewItem`. In the `Add New Item` wizard, select the Resource File option and name the filename as `Syncfusion.SfGrid.WPF.<culture name>.resx`. For example, you have to give name as `Syncfusion.SfGrid.WPF.de.resx` for `German` culture. In the same way, add new resource files for other libraries used in your application.
49+
50+
![Adding custom resource file for localization](AddingCustomResourceFile.png)
51+
52+
4. Now, select Add and add resource file for German culture in `Resources` folder and set `AccessModifier` property to No code generation.
53+
54+
![Included the custom resource file for localization](CustomResourceFile.png)
55+
56+
5. Now, you can copy the key names from the default resource files and assign values based on the culture and the resource files’ targets.
57+
58+
![DataGrid with Localization applied](LocalizationAppliedToDataGrid.png)

wpf-datagrid-localization.PNG

-50.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)