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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

TimeSpanEdit with hour-values greater than 24?

Thread ID:

Created:

Updated:

Platform:

Replies:

150593 Jan 13,2020 08:04 AM UTC Jan 21,2020 03:30 PM UTC WPF 4
loading
Tags: TimeSpanEdit
Martin Hagenow
Asked On January 13, 2020 08:04 AM UTC

Hi,

does anyone know a way to get the TimeSpanEdit accepting inputs for hours greater than 24?

Use case:A testbench is calculating idle times (in minutes) which are assigned to a cause manually. E.g. 31:25 (hours:minutes) for case "user absent".

The standard behaviour of the control when you enter 31 hours is to show the difference to 24. For example if you enter 31 hours and the controls will show 7. (31-24).

To enter the day like 1.07:25 is not an option.

Thanks in adavnce for your suggestions!

Best regards!

Martin

Kanniyappan Panneer Selvam [Syncfusion]
Replied On January 14, 2020 07:37 AM UTC

Hi Martin Hagenow 
 
Thanks for contacting Syncfusion support.

We are currently validating your query and updating the further details on 20th January 2020. 
 
We appreciate your patience until then. 

Regards, 
Kanniyappan P 


Niranjan Kumar Gopalan [Syncfusion]
Replied On January 20, 2020 01:49 PM UTC

Hi Martin, 
 

We have checked your query “ Need to get the TimeSpanEdit accepting inputs for hours greater than 24”. We have created a work around solution to meet your criteria when the format is “hh:mm:ss”. Please refer the below sample and code snippet for same. This solution works properly for hour format alone (i.e . when format contains day and when you enter 48 value in hours, the day value will not update). Please let us know if the provided solution has satisfied your criteria.

XAML:

<syncfusion:TimeSpanEdit  Grid.Row="0" Name="myTimeSpanEdit"  Height="23"  Width="180"                                             Format="hh:mm:ss" Value="12:10:25"  ValueChanged="myTimeSpanEdit_ValueChanged" >            </syncfusion:TimeSpanEdit>

C#:

private void myTimeSpanEdit_ValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

        {

            if ((int)TimeSpan.Parse(e.NewValue.ToString()).TotalHours > 24)

            {

                int hour = (int)TimeSpan.Parse(e.NewValue.ToString()).TotalHours % 24;

                (d as TimeSpanEdit).Value = new TimeSpan(hour, (d as TimeSpanEdit).Value.Value.Minutes, (d as TimeSpanEdit).Value.Value.Seconds);

            }

        }

Sample link:   https://www.syncfusion.com/downloads/support/forum/150593/ze/CS1370601099

 
Regards, 
Niranjan Kumar 


Martin Hagenow
Replied On January 21, 2020 09:51 AM UTC

Perfect!

Many Thanks!

Regards,

Martin

Niranjan Kumar Gopalan [Syncfusion]
Replied On January 21, 2020 03:30 PM UTC

Hi Martin, 
 
Thanks for your update. 
 
Please let us know if you have further queries. We will be happy to assist you. 
 
Regards, 
Niranjan Kumar 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon