Can you hide the Textbox?

2 posts, 1 answers
  1. Andrew
    Andrew avatar
    104 posts
    Member since:
    May 2008

    Posted 14 Mar 2013 Link to this post

    Is there a simple way to hide the textbox portion of the RadDatePicker control? I want the button and calendar functionality to remain as is but want to completely override the display method.

  2. Answer
    Vladi avatar
    743 posts

    Posted 19 Mar 2013 Link to this post

    Hi Andrew,

    There are two possible solutions in removing the input RadWatermarkTextBox of the DatePicker control.
    1. Edit the Template of the control and remove the corresponding RadWatermarkTextBox.
    2. Use the Loaded event of the control, drill to the RadWatermarkTextBox and set its Visibility to Collapsed.

    The next code snippet shows how the Loaded event should look like in order to remove the input WatermarkTextBox:
    in xaml:

    <telerik:RadDatePicker Loaded="DatePicker_Loaded_1"/>

    and in the code behind:
    private void DatePicker_Loaded_1(object sender, RoutedEventArgs e)
        var datePicker = sender as RadDatePicker;
        var datePickerTextBox = datePicker.ChildrenOfType<RadWatermarkTextBox>().FirstOrDefault() as RadWatermarkTextBox;
        datePickerTextBox.Visibility = System.Windows.Visibility.Collapsed;

    Hope this is helpful.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
Back to Top