Global Date Format

4 posts, 0 answers
  1. gerardo
    gerardo avatar
    41 posts
    Member since:
    Dec 2014

    Posted 21 Feb Link to this post

    I have multiple RadDateTimePicker in different forms/pages. Can I set the display format of RadDateTimePicker in styling to have it applied globally across the project? 

     

    Thank you.

  2. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1258 posts

    Posted 24 Feb Link to this post

    Hello Gerardo,

    Indeed, you can create a custom attached property and then set it via an implicit style (in your App.xaml, for example) to apply it to all RadDateTimePicker instances in your application. In the property's property changed callback you can set the desired formats of the created CultureInfo as shown in the Formatting article.

    Please let me know whether such an approach would work for you.

    Regards,
    Dilyan Traykov
    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/.

  3. gerardo
    gerardo avatar
    41 posts
    Member since:
    Dec 2014

    Posted 01 Mar in reply to Dilyan Traykov Link to this post

    Thank you for your response Sir.

    I was able to apply the custom Date format with that approach.

    I have set the DisplayFormat to Long and have a custom property Longdateformat to "dd-MMM-yyyy" and displays the value properly. 

    With those property set, I can input the following and have the display format of "28-Feb-2021" 

    28-feb-2021

    02-28-2021

     

    But when I input 28-02-2021 it displays an error. 

    Is it possible to accept the 28-02-2021 since the display format is "dd-MMM-yyyy"?

  4. Dilyan Traykov
    Admin
    Dilyan Traykov avatar
    1258 posts

    Posted 02 Mar Link to this post

    Hello Gerardo,

    Can you please specify what CultureInfo you've set as the Culture of the control?

    I tried replicating the behavior you described in a small sample project, however, the " 28-02-2021" input is parsed successfully.

    Can you please have a look at the attached project and let me know how it differs from the one at your end?

    Regards,
    Dilyan Traykov
    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/.

Back to Top