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.
Unfortunately, activation email could not send to your email. Please try again.

Change Increment Step Value in TimeSpanEdit

Thread ID:

Created:

Updated:

Platform:

Replies:

124227 May 25,2016 09:59 AM Jun 6,2016 06:28 AM WPF 5
loading
Tags: TimeSpanEdit
James Randle
Asked On May 25, 2016 09:59 AM

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.

Durga Rajan [Syncfusion]
Replied On May 26, 2016 06:58 AM

 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.  


James Randle
Replied On May 26, 2016 07:35 AM

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.

Durga Rajan [Syncfusion]
Replied On May 27, 2016 07:29 AM

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.

James Randle
Replied On June 3, 2016 08:36 AM

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.

Durga Rajan [Syncfusion]
Replied On June 6, 2016 06:28 AM

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.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;