This is a migrated thread and some comments may be shown as answers.

TimePicker Clear button not showing

1 Answer 179 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Nour
Top achievements
Rank 1
Nour asked on 07 Oct 2018, 12:40 PM

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

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Oct 2018, 01:09 PM
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.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Nour
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or