TimePicker Clear button not showing

2 posts, 0 answers
  1. Nour
    Nour avatar
    1 posts
    Member since:
    Dec 2015

    Posted 07 Oct 2018 Link to this post

    Hello,

    I'm trying to use RadTimePicker but i have a problem if a user selected a time, no way to clear the timepicker after a lot of search i found that this control has a clear button buildin, i made the button it visible and set it text once i run the application (Windows Application) it doesn't show at all.

    I tried by code and by Edit UI Elements.

    ((Telerik.WinControls.UI.RadTextBoxElement)(RadTimePicker1.TimePickerElement.Children[2].Children[0])).ClearButton.Visibility = ElementVisibility.Visible;
    ((Telerik.WinControls.UI.RadTextBoxElement)(RadTimePicker1.TimePickerElement.Children[2].Children[0])).ClearButton.Text = "Clear";
    ((Telerik.WinControls.UI.RadTextBoxElement)(RadTimePicker1.TimePickerElement.Children[2].Children[0])).ShowClearButton = true;

     

    Could you please advice.

    Thank you

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3217 posts

    Posted 09 Oct 2018 Link to this post

    Hello, Nour, 

    You can find below a sample code snippet demonstrating how to add a clear button in RadTimePicker in order to delete the current value in the control:

    private void RadForm1_Load(object sender, EventArgs e)
    {
        RadButtonElement clearButton = new RadButtonElement("Clear");
        clearButton.StretchVertically = false;
        clearButton.Click += clearButton_Click;
        TimeTableStackLayoutElement mainStack = this.radTimePicker1.TimePickerElement.PopupContentElement.FindDescendant<TimeTableStackLayoutElement>();
        this.radTimePicker1.TimePickerElement.PopupContentElement.FooterPanel.Visibility = ElementVisibility.Collapsed;
        mainStack.Children.Add(clearButton);
    }
     
    void clearButton_Click(object sender, EventArgs e)
    {
        radTimePicker1.Value = null;
    }



    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Regards,
    Dess
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top