This is a migrated thread and some comments may be shown as answers.

DataFormDateEditor Date Format

3 Answers 7 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Rodrigo
Top achievements
Rank 1
Veteran
Rodrigo asked on 21 Oct 2020, 08:27 PM

Hi,

using com.telerik.widget.dataform.visualization.RadDataForm in Xamarin Native Android app.

By Default, DataFormDateEditor has Date Format "MMM dd, YYYY" and First day of the week is Sunday.

How can I change date format to dd.MM.YYYY and First Day of the week to Monday?

Setting Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture seems not to have any effect...

Regards,

Rodrigo

3 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 23 Oct 2020, 10:56 AM

Hi Rodrigo,

The date format of the DataFormDateEditor is defined per the application Locale and I am afraid we do not provide means to specify it.

So, basically, you can change the application Locale, thus not taking into account the target device Locale.

Setting the application Locale on Android is a little bit tricky, I have tested the following snippet inside OnCreate method of your MainActivity which works:

var locale = new Java.Util.Locale("en", "GB"); // lang => en; region => GB
Java.Util.Locale.Default = locale;
var context = Application.Context;
context.Resources.Configuration.Locale = locale;

context.Resources.UpdateConfiguration(context.Resources.Configuration, context.Resources.DisplayMetrics);

The problem is it uses deprecated API, here are some discussions on StackOverflow on the matter that can help:

https://stackoverflow.com/questions/40221711/android-context-getresources-updateconfiguration-deprecated

https://stackoverflow.com/questions/42535958/android-locale-and-updateconfiguration-are-deprecated

Let me know if I can assist with anything else.

Regards,
Yana
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Rodrigo
Top achievements
Rank 1
Veteran
answered on 27 Oct 2020, 08:03 PM

Thank you very much,

that worked. Just a small note: if Android.App.Application.Context is used as per example - then Date Format is applied, but First day of the week stays Sunday. But if BaseContext is used then First Day of the week get set to Monday, as expected.

0
Yana
Telerik team
answered on 28 Oct 2020, 07:12 AM

Hello Rodrigo,

Thank you for sending that tip, it would be of much help to our users who also come across such a situation.

Regards,
Yana
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
DataForm
Asked by
Rodrigo
Top achievements
Rank 1
Veteran
Answers by
Yana
Telerik team
Rodrigo
Top achievements
Rank 1
Veteran
Share this question
or