We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Change Increment Step Value in TimeSpanEdit

Hi,
How do i change the increment step value on the TimeSpan edit control?
Currently, it only increments/decrements the selected part of the TimeSpan (hours,minutes,seconds) by 1 unit when i click up or down.
For example, it would be nice if clicking up always incremented by 15 minutes ... how can this be achieved?

Furthermore, if i single click part of the TimeSpan (minutes for instance), and then click up or down, the hours continue to change, rather than the selected part.
Double clicking part of the TimeSpan results in it being correctly incremented when i next click up or down.
Surely, single clicking part of the TimeSpan should be treated as that part being selected?

Cheers,
James.

5 Replies

DR Durga Rajan Syncfusion Team May 26, 2016 10:58 AM UTC

 Hi James,

Query : How do I change the increment step value on the TimeSpan edit control?
By default, the interval to increment or decrement the value of TimeSpanEdit will be 1(one) So we can't give specific interval to increment or decrement the value of TimeSpanEdit.

Query : Furthermore, if I single click part of the TimeSpan (minutes for instance), and then click up or down, the hours continue to change, rather than the selected part. Double clicking part of the TimeSpan results in it being correctly incremented when i next click up or down. Surely, single clicking part of the TimeSpan should be treated as that part being selected? 

We were able to reproduce the issue "Hour value will change, if we increment or decrement the other values(minutes or second) of the TimeSpanEdit ". This issue had been fixed in our latest version [14.1.0.41]. So could you please upgrade to our latest version in order to get the issue fixed?

Regards,
Durga S.  



JR James Randle May 26, 2016 11:35 AM UTC

Hi Durga,
Thanks for your reply.

What strategy would you recommend to create the required functionality to increment by a different default value?

Custom control inherited from the existing control? A user control? Modifying the template and binding to a different command?

Can you explain why a particular approach is better?

An example would be great for the community as I expect this is a common requirement!

Many thanks,
James.


DR Durga Rajan Syncfusion Team May 27, 2016 11:29 AM UTC

Hi James,

We suggest you to use OnPreviewMouseDown event to increment or decrement a default value of interval of the TimeSpanEdit instead of using inherited custom control or user control. This would be the best approach to change the default interval value of TimeSpanEdit, because you can achieve the expected behavior of TimeSpanEdit without any modification of the existing template and create custom control inherited from TimeSpanEdit. We have attached a sample and you can modify the given sample according to your requirement. Please download the same from following link

Sample:

TimeSpanEdit_Sample

Regards,
Durga S.


JR James Randle June 3, 2016 12:36 PM UTC

Hi Durga,
Thanks very much for your reply.

I've had a look at the sample and it does exactly what i wanted! Thanks.

Is it possible to also use the keyboard (for accessibility reasons) ... i've tried listening to the PreviewKeyDown event, but it only seems to work if i remove the preview mouse handlers.
I also tried listening to the button click events, but as i'm sure you already know, there is no way to cancel the default increment being added from the click event.

Thanks again,
James.


DR Durga Rajan Syncfusion Team June 6, 2016 10:28 AM UTC

Hi James,

Query : Is it possible to also use the keyboard (for accessibility reasons) ... I’ve tried listening to the PreviewKeyDown event, but it only seems to work if i remove the preview mouse handlers.

Yes, it is possible to use keyboard to increment or decrement a default interval value of TimeSpanEdit control. We have prepared a sample using PreviewKeyDown event to increment or decrement an interval value and you can download the same from the following link.

Sample:
TimeSpanEdit_modified_sample


Query : I also tried listening to the button click events, but as I’m sure you already know, there is no way to cancel the default increment being added from the click event.

We cannot cancel the default increment being added from the click up and down buttons. But we can collapse the up and down buttons by setting ShowArrowButtons property as false in TimeSpanEdit control. If we misunderstood your requirement please update more details about your query.

Regards,
Durga S.  


Loader.
Live Chat Icon For mobile
Up arrow icon