In an application, I am trying to use a 24 hour date format, but running into a problem where my bindings in xaml are still reverting to displaying a 12 hour format
Before the UI is shown, I update the CultureInfo
object with HH:mm and HH:mm:ss as the Short and Long Time formats.
Then, in the UI, I bind to a DateTime
object with a FormatString in the binding
<TextBlock Text="{Binding TimeTest, StringFormat=t}" />
My Expectation is that I'd see 17:33, but end up seeing 5:33 PM. A workaround we've found is to pass in the current culture, but would like to avoid having to do this on every binding that potentially uses time.
<TextBlock Text="{Binding Date, StringFormat=t, ConverterCulture={x:Static gl:CultureInfo.CurrentCulture}}" />