DateTimeEditBox: weird behaviour when using Minimum and Maximum value

Editors for WPF Forum

Posted 5 years ago by Tim C
Version: 18.1.0675
Avatar

I'm using a TimeEditBox with a Minimum and Maximum value set:

<actipro:TimeEditBox x:Name="myTime" Value="00:00" Format="HH:mm" SpinnerVisibility="Visible" SpinWrapping="SimpleWrap" Minimum="00:00" Maximum="23:59"/>

When clicking the increment button of the spinner, the value jumps to 23:59, and after that the value cannot be edited by the spinner controls anymore. This happens as soon as the Maximum value is set. If I leave it out, it seems to work correctly. I noticed that the default Minimum value is set to "1-1-53, 0:00:00". My guess is that by setting the Maximum value, the Minimum value is set to the same value (because the new Maximum value is smaller than the default Minimum value). Because I'm only interested in the Time component of the DateTime object, I am working with DateTime objects with Date 1-1-1. 

Any ideas on what I'm doing wrong or how I can get the normal behaviour?

Thank you,

Tim

Comments (5)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tim,

We dug into this and what's happening is that when we call DateTime.TryParse on the text you enter/spin (e.g. "01:00"), it's pulling the time back correctly but with the current date into the DateTime result instead of date 1-1-1.

Since the current date falls outside of the "1-1-1 0:00" to "1-1-1 23:59" range, it's rounding to the latter value, which is the closest.  So you end up seeing "23:59" as a result.

It's difficult to work with only times since we still have to rely on the DateTime structure.  Do you have any suggestions?  Perhaps for time increments we update the "date" portion of the incremented DateTime result to whatever date is in the Minimum value?


Actipro Software Support

Posted 5 years ago by Tim C
Avatar

That sounds like a good idea to me, thanks. 

Answer - Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Tim,

We were able to update the code to make sure the date stays on the current Value's date.  This seems to work with your example and lets the spinners work properly.  This code update will be in the next build.

If you'd like to try a preview build, please write our support address and mention this thread.


Actipro Software Support

Posted 5 years ago by Tim C
Avatar

When is the next build expected?

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The official build might be several weeks out yet.


Actipro Software Support

The latest build of this product (v24.1.1) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.