Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TimePicker > How To Disable TextBox Input

Not answered How To Disable TextBox Input

Feed from this thread
  • KO avatar

    Posted on Jan 12, 2011 (permalink)

    Greetings:

    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,

    KO

    Reply

  • KO avatar

    Posted on Jan 12, 2011 (permalink)

    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.

    Reply

  • Kaloyan Kaloyan admin's avatar

    Posted on Jan 14, 2011 (permalink)

    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"
                    VerticalAlignment="Center">
                <telerik:RadTimePicker.DateTimeWatermarkTemplate>
                    <DataTemplate>
                        <Grid>
                            <TextBox Text="{Binding}" IsReadOnly="{Binding IsReadOnly}"
                                    BorderBrush="{x:Null}" />
                        </Grid>
                    </DataTemplate>
                </telerik:RadTimePicker.DateTimeWatermarkTemplate>
            </telerik:RadTimePicker>


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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Silverlight > TimePicker > How To Disable TextBox Input
Related resources for "How To Disable TextBox Input"

Silverlight TimePicker Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]