How To Disable TextBox Input

3 posts, 0 answers
  1. KO
    KO avatar
    16 posts
    Member since:
    Apr 2010

    Posted 12 Jan 2011 Link to this post


    If I add a collection of valid time values using the ClockItemsSource property, how can I make the TimePicker only consider the added times as valid? For example, if I add the times 8:00 AM, 11:00 AM and 2:00 PM, I consider all times except those three times as invalid data. Yet the user can type the value 123 and the control will accept the time 12:03 PM without question.

    I would like to simply set the TextBox portion of the TimePicker to read-only. This way I would have complete control over valid values by letting the user select them from the dropdown. Can this be done? If not, can you recommend an easy way to prevent the user from entering invalid times?

    Thank you,

  2. KO
    KO avatar
    16 posts
    Member since:
    Apr 2010

    Posted 12 Jan 2011 Link to this post

    I came across RadClock immediately after starting this thread. I see how I could use RadClock with my own TextBox. However, if there is an easy way to simply disable the RadTimePicker's TextBox, that would sure be simpler. Thanks.
  3. Kaloyan
    Kaloyan avatar
    920 posts

    Posted 14 Jan 2011 Link to this post

    Hello KO,

    I am not sure weather I am understanding your case correctly. Initially you can use the DateTimeWatermarkTemplate property to set a TextBlock bounded to a property(bool for example) that will enable/disable the user input in case of invalid time typed. Follow the code bellow:

    <telerik:RadTimePicker x:Name="radTimePicker" HorizontalAlignment="Center"
                            <TextBox Text="{Binding}" IsReadOnly="{Binding IsReadOnly}"
                                    BorderBrush="{x:Null}" />

    Best wishes,
    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top