I've read many forum entries regarding clearing the text in a DateTimePicker and also showing the Clear and Today buttons. So I have tested with this code and made things work well enough so far.
The text clears when I press the Delete key and the calendar shows the Clear and Today buttons.
1. What's the Clear button supposed to do? Am I supposed to handle the event myself or is it supposed to clear out the date? I don't see anything happening when I click that, even without handling the KeyDown event.
2. From the older forum posts I've read, I think that maybe there is a way to use the properties of the RadDateTimePicker to clear the text without having to extend the control and add a KeyDown handler and other property settings. Is there some way to do that via the properties of the control now?
Thank you,
Gary
public Form1() { InitializeComponent(); RadDateTimePickerCalendar datePickerCalendarBehavior = (this.dtpTest.DateTimePickerElement.GetCurrentBehavior() as RadDateTimePickerCalendar); RadCalendar calendar = datePickerCalendarBehavior.Calendar; calendar.ShowFooter = true; calendar.CalendarElement.CalendarStatusElement.Text = ""; datePickerCalendarBehavior.DropDownMinSize = new Size(250, 250); dtpTest.NullableValue = null; dtpTest.NullDate = System.Convert.ToDateTime("01/01/0001"); dtpTest.NullText = " "; } private void dtpTest_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Delete) { dtpTest.SetToNullValue(); e.Handled = true; } }The text clears when I press the Delete key and the calendar shows the Clear and Today buttons.
1. What's the Clear button supposed to do? Am I supposed to handle the event myself or is it supposed to clear out the date? I don't see anything happening when I click that, even without handling the KeyDown event.
2. From the older forum posts I've read, I think that maybe there is a way to use the properties of the RadDateTimePicker to clear the text without having to extend the control and add a KeyDown handler and other property settings. Is there some way to do that via the properties of the control now?
Thank you,
Gary
