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

Date and times are not displayed in the right locale

9 Answers 203 Views
FileDialogs
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Patrick asked on 26 Jun 2020, 12:49 PM

Hello,

I have Windows 10 in English, but the date display in Swiss French.

In the save dialog (not checked the other ones, but it should be the same), the date and time are displayed in the US format, with AM/PM).

You must use the Windows settings to display the date and time correctly.

9 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 01 Jul 2020, 10:37 AM

Hello Patrick,

Thank you for your interest in our RadFileDialogs for WPF.

I am a little unsure about which date you are referencing in your post. May I ask you to elaborate more on this behavior? You can send me images, for example, of the observed behavior.

I am looking forward to your reply.

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 01 Jul 2020, 11:43 AM

Hi Dinko,

The last changed date that is displayed in the "details" view.

0
Dinko | Tech Support Engineer
Telerik team
answered on 06 Jul 2020, 08:09 AM

Hello Patrick,

Thank you for the provided image.

I am currently reviewing your scenario and I need a little more time for that. I will contact you again tomorrow with my findings.

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Dinko | Tech Support Engineer
Telerik team
answered on 07 Jul 2020, 12:52 PM

Hi Patrick,

Thank you for your patience.

I think the problem comes from the fact that the RadGridView does not respect the CurrentCulture Format settings when formatting its data. You can read more about this behavior in the CurrentCulture Format Settings are not respected troubleshooting article. The tricky part here is how to set it to the RadGridView in the details view as the file dialogs do not expose an API to directly customized it. You will need to create an attached property in which you can subscribe to the RadComboBox(layout configurator) SelectionChanged event. In the event handler, you can check what is the current view. If it is a details view, you can search for the grid and set the IsLocalizationLanguageRespected property to false. 

The attached project demonstrates this approach. Can you give it a try on your side and let me know how it goes.

Regards,
Dinko
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Jul 2020, 01:06 PM

Hi Dinko,

I really think that the Telerik file dialogs should provide this functionnality "out-of-the-box". 

For attaching an event to the layout configurator changed, I've done it in my code to save/load the user settings for the dialog (a complicated thing because Telerik doesn't provide it and accesses to the controls is difficult).

Your solution doesn't work because the GridView is not created when the SelectionChanged event is fired. I had to code it this way:

If LayoutConfigurationModel (Args.NewValue):LayoutType = LayoutType.Details Then
  Dlg.Dispatcher.BeginInvoke (  // waits for Telerik to put the grid view into place
    DispatcherPriority.ApplicationIdle,
    ->
    Begin
      DetailsGridView := Dlg.FindChild <RadGridView> (Name_DetailsPane);

      ...

    End)

 

A simple Dispatcher.BeginInvoke doesn't work when the layout is changed using Ctrl+MouseWheel (a lot of code to implement this correctly). Adding DispatcherPriority.ApplicationIdle seems to work in all cases.

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 07 Jul 2020, 01:52 PM

Hi again Dinko,

Setting the IsLocalizationLanguageRespected property of the GridView to False still displays the date and time in US format.

0
Dinko | Tech Support Engineer
Telerik team
answered on 10 Jul 2020, 11:22 AM

Hello Patrick,

Thank you for the provided update.

 If I change the date format on my side the grid correctly displays the date in the column. To further investigate this, can you share the time format and regional settings on your machine. You can send me images of the settings so that I can change it on my side and test it.

I am looking forward to your reply.

Regards,
Dinko
Progress Telerik

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 10 Jul 2020, 11:32 AM

Hi Dinko,

Please find attached the information.

Best resgards

0
Dinko | Tech Support Engineer
Telerik team
answered on 15 Jul 2020, 10:07 AM

Hi Patrick,

Thank you for the provided images.

After running a few tests on my side, I was able to reproduce this behavior. It turns out the date format is not applied correctly initially. If you, for example, navigate to a folder after you have loaded the details view, the format is shown correctly. To workaround this, you can call the Rebind() method of the RadGridView after setting the IsLocalizationLanguageRespected to false.

private static void ComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
    if (e.AddedItems.Count > 0)
    {
        if ((e.AddedItems[0] as LayoutConfigurationModel).NameKey == "FileDialogs_Details")
        {
            Application.Current.Dispatcher.BeginInvoke((Action)(() => {

                RadGridView gridView = FileDialog.ChildrenOfType<RadGridView>().FirstOrDefault();
                gridView.IsLocalizationLanguageRespected = false;                        
                gridView.Rebind();
            }));
        }
    }
}

In addition: The DispatcherPriority is not necessary in this case, at least on my side.

Regards,
Dinko
Progress Telerik

Tags
FileDialogs
Asked by
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or