I’ve a WPF4 Application.
There I bind an UI Control to a DateTimeOffSet value.
For example a textblock
<TextBlock Text="{Binding Due.LocalDateTime,StringFormat='{}{0:dd MMM HH:mm}'}"/>
But I want a culture aware display of the value.
So for example in germany there is a 24h represenation and in america a AM/PM representation.
What is the best / smartest way to realize this ?
Do I need a covnerter ? or is there a way to represent this in a xaml ?
Also the order of the date fields are different and so on…
There are a ton of workarounds for this questionable “by-design” behavior here:
http://connect.microsoft.com/VisualStudio/feedback/details/442569/wpf-binding-uses-the-wrong-currentculture-by-default
To exactly replicate the custom settings chosen by the user in the Regional Settings control panel applet is hard, but generic locale-specific settings is easy enough by setting the xml:lang attribute.
E.g., you can add something like this to your top-level window element, for example:
Again, I must stress, that this isn’t perfect, because any custom display preferences chosen by the user will be ignored.