This project has moved and is read-only. For the latest updates, please go here.

DateTime format not correctly localized for readonly properties in PropertyGrid

Jan 29, 2012 at 7:48 PM


when marking a DateTime property with the ReadOnlyAttribute the date is always formatted with en-US long date time format in the PropertyGrid.
Is there a way to fix this?

Thanks in advance


Jan 31, 2012 at 3:37 PM

If I remember correctly the default formatting is CurrentCulture.LongDatePattern with or without an attribute.  The attirbute should have no affect on the format.  You will have to define a custom editor for your dateTime properties which has the desired format string..

Feb 7, 2012 at 8:15 PM

Hi, when removing the ReadOnlyAttribute, the DateTime property is formatted correctly corresponding to the CurrentCulture. My current workaround is to set the xml:lang attribute in the XAML document. Setting UICulture in the Project file or setting the NeutralResourcesLanguageAttribute in the assembly info file has no effect.

I will try the custom editor now.