Localize Dates, Currency, Numbers, and Text Direction in WPF

Published: 31 August 2020
on channel: Brian Lagunas
3,819
162

In this video, I show you how to "Localize Dates, Currency, Numbers, and Text Direction in WPF".

When writing WPF applications, it's important to localize your apps to respect the current culture the user of your app is using. For example, you will want to make sure localize dates, currency, numbers, and text direction based on the language the user is using.

To handle localizing dates, currency, and numbers, we will utilize the "Language" property that WPF provides on every element. Instead of hard coding the property on every element, we will override the metadata of the FrameworkElement.LanguageProperty to apply the proper culture to all elements in our WPF application.

As you know, some languages are read from right-to-left instead of left-to-right. By default, all content in a WPF app will read left-to-right. However, if you are using a language such as Arabic, you need to change you application to read right-to-left. To do this, we set the FlowDirection property on all WPF elements in the application in order to localize the text direction of our application.

As you can see, to localize dates, currency, numbers, and text direction can be done with just a few lines of code. While there is much more work to fully localize WPF application, this is a great start.

Be sure to watch my new Pluralsight course "Introduction to Prism for WPF":
https://pluralsight.pxf.io/bE3rB

Sponsor Me:
https://github.com/sponsors/brianlagunas

Follow Me:
Twitter:   / brianlagunas  
Twitch:   / brianlagunas  
Blog: http://brianlagunas.com
GitHub: https://github.com/brianlagunas


Watch video Localize Dates, Currency, Numbers, and Text Direction in WPF online without registration, duration hours minute second in high quality. This video was added by user Brian Lagunas 31 August 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,81 once and liked it 16 people.