Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
295
XamDateTimeEditor
posted

I am using XamDateTimeEditor and found a strang problem with it. When i databind the TextProperty to a property(of type nullable of DateTimie) the control only accepts the US format (for dates) but when i databind the ValueProperty all works fine (accepts UK formats).it doesn't accept the UK format for the previous case.

can some one please explain to me is it a bug or what i am doing is wrong? i am quite new to WPF.

Kind Regards

Devinder Singh

Parents
No Data
Reply
  • 54937
    Offline posted

    The Text property is of type string so the wpf framework is going to convert that datetime to a string. The wpf framework uses the FrameworkElement.Language property to determine the culture of the bindings and that defaults to en-US so that's probably why you are seeing this issue. You can try setting the Language property to the culture you are using. You can take a look at this blog post on one way to handle this.

    The Value property doesn't have this issue because the Value property is of type object and as such the wpf framework isn't converting your value to a string so the editor gets the datetime as a DateTime?.

Children