Problem with DateTimeEditBox format specifier "hh"

Editors for WPF Forum

The latest build of this product (v21.1.1) was released 3 months ago, which was before this thread was created.
Posted 22 days ago by Sherman Ortega
Version: 14.1.6
Platform: .NET 4.6
Environment: Windows 10 (64-bit)
Avatar

Hi,

I am trying to specify a 12-hour format for my TimeSpanEditBox by using the "hh" specifier.

I can see through Visual Studio's Live Property viewer that the Format has been set to "hh" but I can still enter values greater than 12.

Any way to get around this issue?

Thanks!

Comments (3)

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

Hello,

I'm sorry but the format won't limit what can be typed into the control.  That being said, the format will determine how a committed value (after spinning, pressing Enter, programmatic value change, etc.) renders in the control.  The control doesn't have a way to limit what can be typed in a certain location.


Actipro Software Support

Posted 22 days ago by Sherman Ortega
Avatar

"That being said, the format will determine how a committed value (after spinning, pressing Enter, programmatic value change, etc.) renders in the control."

Can you tell me more about this statement? 

I am currently limited to 24 hour format, so I can only enter 0-23. As I type 24 in the control, I can only type 2 and 4 will not be accepted (4 will not appear in the control as I type it). I am looking for a similar behavior for a 12hour format.

[Modified 22 days ago]

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

Hello,

My apologies, I didn't notice you were on an older v14.1.  Yes the older Editors version did only allow input based on a regular expression syntax.  Since it was made with a custom textbox implementation, it allowed us to do some input blocking like that.  The downsides of this original implementation was that it used a lot of elements and bindings (making the edit boxes somewhat resource intensive), it prevented any kind of alternate input and could have issues in some cases where certain cultures had extensive changes from the norm, and didn't support things like IME input.

When Editors were refactored in v17.1, we greatly simplified the edit box design so they are much more lightweight.  When many instances are used in data grids, they now load a lot faster and with less memory.  They are more freeform, allowing for more expressive text input, and support IME input.  They still support spinning values, and navigation between parts.  And the design is compatible with UWP.  The only main downside of the new design is that we lost the ability to restrict input as it's being typed, which is what I was originally referring to.

Looking at the TimeSpanHoursPart code in v14.1, it seems like the code that validates an hour can be parsed just checks for 0..23 range and isn't considering the format to possibly restrict to 0..11.  I don't think there's a way to alter that logic externally, at least easily.


Actipro Software Support

Add Comment

Please log in to a validated account to post comments.