Open calendar with another key

Hi

The DateTimeEdit component is opened by default with the enter key pressed. I looked in the documentation and couldn't find a way to change this key. I would like it to be possible to customize the key to open the calendar. This is due to a need in the system I am developing, where the enter key must have other behavior.

I appreciate the help!

3 Replies

AI Anirudhan Iyyappan Syncfusion Team February 18, 2020 10:34 AM UTC

Hi, 
 
Query 1 : “The DateTimeEdit component is opened by default with the enter key pressed”. 
 
We can restrict the default enter key behavior by disabling the property “AllowEnter ”. Please refer to the below documentation for further reference. 
 
 
Query 2 : I would like it to be possible to customize the key to open the calendar”. 
 
We can use “IsDropDownOpen” property to show or hide the calendar in DateTimeEdit. By handling the key down event we can able to show the calendar on required keys. Please check with the below sample.  
 
Code Example[C#] : 
 
private void datetime_KeyDown(object sender, KeyEventArgs e) 
{ 
     // Check the required keys here to open or close the drop dowm. 
     if (e.Key == Key.LeftCtrl) 
     { 
         datetime.IsDropDownOpen = !datetime.IsDropDownOpen; 
     } 
} 
 
We have prepared the sample for the same and its can be downloaded form below: 
 
Regards, 
Anirudhan 



TS Tech Shop February 18, 2020 11:00 AM UTC

Hi

Worked perfectly. Thanks!


SK Senthil Kumaran Rajan Syncfusion Team February 18, 2020 11:34 AM UTC

Hi,
 
Thanks for your update.
 
We are glad to know your reported behavior has been resolved. Please let us know if you need further assistance.
 
Regards,
Senthil

Loader.
Up arrow icon