5 Answers, 1 is accepted
Currently the DateTimePicker control closes its popup when value is selected with the mouse only if it its InputMode is DatePicker or TimePicker. If you want to change this behavior you need to handle the DateTimeSelectedWithMouseEvent routed event of the RadDateTimePicker control (it is not exposed as a CLR event, but you can still handle it). Here is our current code that closes the DateTimePicker drop-down. What you will need to do is similar:
the Telerik team
We have a DateTimePicker where the inputmode is DateTimePicker. However we only want to close the dropdown when the Time is selected. You solution does not cater for this.
Can you propose a way to do this using your DateTimeSelectedWithMouseEvent. We just need to test that the Time portion of the control has been selected.
What I would suggest you is to change the code in the event handler with the following:
The idea is to identify which control was actually clicked - the calendar or the clock and if the clock is clicked, than close the drop down.
Hope this helps. Regards,
the Telerik team
I succeeded with auto close in case of time input section selected. Using this
sender, RoutedEventArgs args)
var picker = sender
// If the picker is a DateTimePicker and the drop-down is opened than close it if mouse down on time selection.
&& picker.InputMode == InputMode.DateTimePicker && picker.IsDropDownOpen &&(args).OriginalSource is RadClock)
Now I'm using the fix described above, and it works like a charm:
private void DatePicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
ViewModel.CurrentPeriodChangeInfo.CurrentDate = DateTimePicker.DisplayDate;
DateTimePicker.IsDropDownOpen = false;