Leave Invalid Value in in DatePicker

2 posts, 0 answers
  1. Robert Staniskis
    Robert Staniskis avatar
    3 posts
    Member since:
    Apr 2010

    Posted 14 Apr 2011 Link to this post


    I have a requirement for date controls to leave the invalid date in the textbox instead of blanking it out.  As an example, if there user were to type "abc" into a DatePicker control, the control needs leave the text in the box.  I am running my own custom validation routines so I notify the user that the value is invalid on my own.  Can you tell me how to leave the text in the DatePicker textbox even if the value is not a valid date?

    Thanks for your help and awesome controls!

  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 19 Apr 2011 Link to this post

    Hello Robert,

    To achieve the desired behaviour you will have to edit the template of the DatePicker. You can easily do this using Expression Blend. Just drop a DatePicker control into the design surface, right-click it and choose from the menu Edit Template->Edit a Copy. Then Blend will generate all the needed resources. Find the WatermarkTextBlock and remove the Text binding.
    Please find attached a sample project in which the above-mentioned steps are performed.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top