I have a label with the content bound to a DateTime object. I want the format of the DateTime to be dynamic, i.e. if the user changes the culture of the program, the format of the DateTime should change accordingly.
I have a SetCulture method which calls the following:
Thread.CurrentThread.CurrentCulture = new CultureInfo(culture);
Thread.CurrentThread.CurrentUICulture = new CultureInfo(culture);
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(culture);
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(culture);
I have tried this for the label:
Content="{Binding Model.DateTimeNow, ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}"
However the format does not change even when I set a different culture through the methods above.
How can I achieve a dynamic DateTime format?