DateTimeEditBox: weird behaviour when using Minimum and Maximum value

Editors for WPF Forum

The latest build of this product (v2018.1 build 0675) was released 2 months ago, which was before this thread was created.
Posted 22 days 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 22 days 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 21 days ago by Tim C
Avatar

That sounds like a good idea to me, thanks. 

Answer - Posted 21 days 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 11 days ago by Tim C
Avatar

When is the next build expected?

Posted 11 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

The official build might be several weeks out yet.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.