No Null Value Allowed

2 posts, 1 answers
  1. Phillip
    Phillip avatar
    7 posts
    Member since:
    May 2016

    Posted 13 Jun Link to this post

    Hallo everyone,

    how about a Property for the DateTimePicker that can switch on(true) / off (false) for writing in null values. In my case, I don't/can't set the InputField to disable but the user should not be allowed to set the date to null. It would be awesome if the Picker sets its own value automatically to the last valid value by loosing the focus. if there is in the beginning no value in the field its automatically set to the date of today.


    I mean something like the winforms feature:

    datePicker.NullDate = ...

  2. Answer
    Yana avatar
    4547 posts

    Posted 15 Jun Link to this post

    Hello Phillip,

    We consider setting the Value of the DateTimePicker to a previous valid Value as more of application logic that should be handled according to the specific scenario.
    You could implement validation in the ViewModel with the IDataErrorInfo interface as demonstrated in the DateTimlePicker Data Validation example inside WPF Demos or you could just check the SelectedValue and preserve the last valid value in some variable that can be used in case SelectedValue is null.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top