In my case:
I have a TextBlock Binding to a property of type DateTime. I want it to be displayed as the Regional settings of the User says.
This is an extension of answer from aKzenT. They proposed that we should create a subclass of Binding class and set the ConverterCulture to CurrentCulture. Even though the answer is very straight forward, I feel some people may not be very comfortable implementing it, so I am sharing the code version of aKzenT's answer with an example of how to use it in XAML.
using System;
using System.Globalization;
using System.Windows.Data;
namespace MyWpfLibrary
{
public class CultureAwareBinding : Binding
{
public CultureAwareBinding()
{
ConverterCulture = CultureInfo.CurrentCulture;
}
}
}
Example of how to use this in XAML
1) You need to import your namespace into your XAML file:
2) Real world usage of the CultureAwareBinding