Date Format of FeatureDataForm from the toolkit

3152
6
10-28-2014 11:13 PM
ChristosStamatopoulos
New Contributor II

Is there a way to control the display of a date field of a FeatureDataForm ?

At the moment it is displayed in a US format ( M/D/Y ) which would be nice to change to lets say d/m/y.

0 Kudos
6 Replies
AnttiKajanus1
Regular Contributor II

Hey,

Data form should you your UICulture / PrimaryLanguageOverride to define how it's shown. Here is how FeatureDataForm looks on my comp with en-GB locale

Untitled.png

And here with fi-FI locale

Untitled.png

What locale you are using or are you planning to show it in different format that your locale is usually using?

0 Kudos
ChristosStamatopoulos
New Contributor II

My local is set to en-Au locale.png

And what I would expect is that the date would be 30/10/2014 but instead I get 10/30/2014.

The validation of a Date field actually respects that and forces me to input it as it should be in my locale.

However when you apply your changes and go back to the FeatureDataFrom then its displayed incorrectly.

0 Kudos
AnttiKajanus1
Regular Contributor II

It seems that my previous comment was incorrect. Localization is driven by Language attribute, which is how WPF controls handles the localization.

ie.

<toolkit:FeatureDataForm

    Language="en-AU"

    ApplyCompleted="MyDataForm_ApplyCompleted" />

If you want to set application level language definition to correspond you UI Culture you can do this at startup of the application

FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),

  new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

Some resources to read more about this issue :

0 Kudos
ChristosStamatopoulos
New Contributor II

Thanks for you help.

It is interesting that the validation is done using my Language while the display is not.

Creating a simple wpf app and adding a date time field displays fine without the need to set/change anything. So not sure why I need to do so for the toolkit.

In both cases the CultureInfo is en-AU while the cultureUIInfo is en-us.

Forcing a specific language does not sound right to me so the only option is to set the language at startup so that it respects user settings.

ChristosStamatopoulos
New Contributor II

Re-opening this cause there is still an issue with the time.

If in the date time field you set the time to lets say 13:00 and then you apply the changes everything is fine.

When though you go back to the same feature there is a different time set.

The difference is the GMT difference that is set for my pc, in my case +10h so the displayed time is 3:00.

I understand that internally the times are probably kept in UTC but should not they be converted back to the local time on display so the set time and later the displayed are the same ?

0 Kudos
DeanHowell2
New Contributor

Hello Christos,

Did you get a solution to this issue?

We have a single user who is getting the date appearing in US format rather than Australian format but not sure what the issue is. The result is appearing in ArcGIS but am guess that the cause it somewhere else.

Regards

Dean

0 Kudos