locked
Format datetime binding application wide RRS feed

  • Question

  • Hi,

    I want to format the date time format of bindings in multiple forms {Binding StringFormat={} ...}.

    Because I have many bindings, I want to know if there is a way how to configure this application wide as you can do it with styles, etc.

    Thank you!

    Friday, February 22, 2013 8:36 AM

Answers

  • Hi

    Difficult. If you put the binding into a style, you need to specify one and the
    same path/prop-name all the time, which probably doesn't match with your
    existing VMs.
    I think it could work with a custom binding or also (with limits) with a user-defined
    CultureInfo that exposes the very string format as default short and long
    DateTime format and set Thread.CurrentCulture to an instance of this culture.
    Still i wouldn't be too optimistic that all WPF controls are 100% culture-aware.
    Some probably will always display en-us formatted data if you don't specify the
    format explicitly.

    Chris

    • Marked as answer by Torsten Tiedt Friday, February 22, 2013 2:47 PM
    Friday, February 22, 2013 12:04 PM