Click here to Skip to main content
15,884,099 members
Articles / Desktop Programming / Windows Forms
Tip/Trick

Globalization in WPF

Rate me:
Please Sign up or sign in to vote.
4.71/5 (6 votes)
17 Jun 2014CPOL1 min read 21.8K   9   8
Create a multilingual application WPF

Introduction

How can we create a multilingual application in WPF?

Background

This code is developed in VS2012.

Using the Code

Create a new WPF Application Project. By default, you will get App.xaml & MainWindow.xaml forms.

1

Now create a new ClassLibrary project in the same solution for resource files. You can also create resource files in the same project.

And add Resource files in that ClassLibrary. I have added 2 in my project named as Language.resx (for English) and Language.de-DE.resx (for German). Mention your lables, buttons, etc. translations in those files. And make the Access Modifier as PUBLIC

Build your class Library and add reference in WPF project.

Now open App.xaml code behind and write the below lines in default constructor:

By default, I have mentioned de-DE as culture. For English, you can leave it blank.

Now open MainWindow.xaml and design the page as per your requirement. But add the namespace of class library in Window tag as per below:

Now bind the controls as per their content, as per below screen:

And now run the application. That's it................enjoy programming.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Having working experience of 8+ Years in IT , major experience is in Banking/Finance , Engineering, e-Commerce web development.
Worked with .NET, SharePoint. Having good command on SharePoint 2010, ASP.NET with C# , C#, VB.NET, Ajax, JavaScript, WPF, Web Services, Window Services, MS SQL Server, Azure.

Comments and Discussions

 
GeneralMy vote of 5 Pin
Member 1138346324-Nov-15 19:02
Member 1138346324-Nov-15 19:02 
QuestionLanguage change at runtime? Pin
Maximilian Haru Raditya19-Jun-14 9:33
Maximilian Haru Raditya19-Jun-14 9:33 
AnswerRe: Language change at runtime? Pin
Vipul Bhatnagar19-Jun-14 19:22
Vipul Bhatnagar19-Jun-14 19:22 
QuestionThanks Pin
Kapul Kumar Bhatnagar18-Jun-14 20:13
Kapul Kumar Bhatnagar18-Jun-14 20:13 
GeneralThanks for valuable feedback Pin
Vipul Bhatnagar18-Jun-14 3:07
Vipul Bhatnagar18-Jun-14 3:07 
QuestionThanks! Pin
Tokinabo18-Jun-14 2:22
professionalTokinabo18-Jun-14 2:22 
GeneralMy vote of 4 Pin
LLLLGGGG17-Jun-14 2:27
LLLLGGGG17-Jun-14 2:27 
GeneralNice article Pin
Member 803348217-Jun-14 2:15
professionalMember 803348217-Jun-14 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.