Date and times are not displayed in the right locale

10 posts, 0 answers
  1. Patrick
    Patrick avatar
    498 posts
    Member since:
    Aug 2012

    Posted 26 Jun Link to this post

    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.

  2. Dinko
    Admin
    Dinko avatar
    1183 posts

    Posted 01 Jul Link to this post

    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.
  3. Patrick
    Patrick avatar
    498 posts
    Member since:
    Aug 2012

    Posted 01 Jul in reply to Dinko Link to this post

    Hi Dinko,

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

  4. Dinko
    Admin
    Dinko avatar
    1183 posts

    Posted 06 Jul Link to this post

    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.
  5. Dinko
    Admin
    Dinko avatar
    1183 posts

    Posted 07 Jul Link to this post

    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.
  6. Patrick
    Patrick avatar
    498 posts
    Member since:
    Aug 2012

    Posted 07 Jul in reply to Dinko Link to this post

    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.

  7. Patrick
    Patrick avatar
    498 posts
    Member since:
    Aug 2012

    Posted 07 Jul in reply to Patrick Link to this post

    Hi again Dinko,

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

  8. Dinko
    Admin
    Dinko avatar
    1183 posts

    Posted 10 Jul Link to this post

    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

  9. Patrick
    Patrick avatar
    498 posts
    Member since:
    Aug 2012

    Posted 10 Jul in reply to Dinko Link to this post

    Hi Dinko,

    Please find attached the information.

    Best resgards

  10. Dinko
    Admin
    Dinko avatar
    1183 posts

    Posted 15 Jul Link to this post

    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

Back to Top