views:

258

answers:

2

Hello everyone,

I'm getting some very strange date formatting issues in my Silverlight application. My local culture is set to UK, yet I am consistently seeing US dates popping up all over the place. I can easily hardcode these to UK format in specific loactions using:

<UserControl ... Language="en-GB"...>

But as I'm sure you'd all agree this is a terrible thing to do.

I have tried setting the Lanaguage to en-GB in the main application and this has partial success. I have also tried Justin Angels suggestion (posted here: http://stackoverflow.com/questions/477908/how-to-change-date-format-in-silverlight-datepicker-control), again only partial success.

An example of the issue can be seen here:

http://lh3.ggpht.com/%5FL9TmtwXFtew/Sw5aVZJfG1I/AAAAAAAAGkI/6jYnsB91HjI/image%5Fthumb%5B1%5D.png

The datagrid on the parent page shows UK formatting, whilst the information in the ChildWindow shows US formatting ...grrrr

Anyone have a definitive solution for solving this across a whole application?

Thanks, Mark

A: 

Can you not use the SelectedDateFormat property of the datepicker? If you want to do this once could you not create your own usercontrol that derives from the original with this value preset, then use your derived control throughout your app?

Kindness,

Dan

Daniel Elliott
I could use SelectedDateFormat on date pickers but I think this would putting hard coded culture across the app. Would expect that this should "just work" directly from the client culture. Also, this doesn't just relate to date pickers. Sometimes this is bound dates displayed in datagrids, or in textblocks.
Mark Cooper
A: 

Shot in the dark, but does changing the browser's Language Preference make a differnence? I.e. in IE Tools-->Internet Options-->Languages.

HTH

Mark

Mark
Thanks for the suggestion, but I'm already running in "en-gb"
Mark Cooper
Ack, sorry, you said that in your original question, I obviously didn't read it properly.
Mark