is there to way to show only year in raddatepicker

7 posts, 0 answers
  1. Minh
    Minh avatar
    12 posts
    Member since:
    Dec 2013

    Posted 03 Jul 2014 Link to this post

    I want to show only  year on raddatepicker , and the user can enter a value is year.
    But it will error if I just enter the value in 2014,but if I enter 01/01/2014, there is no error message.
    In the hidden code:
     
      timePicker.Culture.DateTimeFormat = new System.Globalization.DateTimeFormatInfo ShortDatePattern = {"yyyy"};

    XAML:
    DateSelectionMode = "Year"


    Sorry my english :)
  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 07 Jul 2014 Link to this post

    Hello Minh,

    When displaying and selecting only years you should also set the ParseExact property of the DatePicker to true:

    <telerik:RadDatePicker ParseExact="False" x:Name="Picker" DateSelectionMode="Year" />

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Minh
    Minh avatar
    12 posts
    Member since:
    Dec 2013

    Posted 08 Jul 2014 in reply to Kalin Link to this post

    Thanks for the reply,
    But,I added, but the error is still not resolved :(
  5. Minh
    Minh avatar
    12 posts
    Member since:
    Dec 2013

    Posted 08 Jul 2014 Link to this post

    it solves one part of my request, so pretty good.
    Tks
  6. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 08 Jul 2014 Link to this post

    Hi Minh,

    You would need to enter the whole year in order to parse it correctly. If you have any further questions, let us know.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Minh
    Minh avatar
    12 posts
    Member since:
    Dec 2013

    Posted 08 Jul 2014 in reply to Kalin Link to this post

    It seems that it has 4 mandatory character,
    and how to turn off the message "error"?

    so, I can check it in LostFocus event
  8. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 10 Jul 2014 Link to this post

    Hi Minh,

    What I can suggest you would be to check the following article from our online help documentation:
    http://www.telerik.com/help/wpf/raddatetimepicker-how-to-implement-custom-parsing.html

    Using the custom parsing you can implement a custom logic which parses correctly only one, two or three digits. You will avoid the error message when the args.IsParsingSuccessful property is set to true.

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WPF is Visual Studio 2017 Ready