DateTimeEditBox: Suppress day validation

Editors for WPF Forum

Posted 8 years ago by Markus Mayer
Version: 11.2.0552
Avatar

Hi,

I can't enter a day greater than 29 before I've decided on a month. This is good and well for validation but feels a little awkward when entering dates by typing especially with IsFocusMovedOnTerminalMatches="True". Is it possible to suppress this validation until the whole date has been changed?

Thanks in advance.

Comments (3)

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

Hi Markus,

Unfortunately, no that is not currently possible. We only ever store the value in a DateTime, so if what you see is not a valid date then we cannot currently display it. The only exception to this rule is the changes currently pending from a single part (i.e. the one with focus). All other parts are coming directly from the DateTime.

We do have special code to correct the day (e.g. if you have 31 as the day and enter 2 as the month, then 31 will be updated to 28 or 29), but we don't have any similar logic for entering a day to update month.


Actipro Software Support

Posted 4 years ago by Kris Goossens - Remmicom
Avatar

Hi,

 

Any update on this issue ?

We have customers complaining while trying to change a date.

Our Belgium date format is day - month - year, so this makes it unconvenient to change the month before the day.

eg initial date 30/06/2015 should be 31/07/2015

 

Thanks,

Kris

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

Hi Kris,

I'm not sure there's anything we can do to improve this with how the product is set up.  We just did some tests in the part to allow "31" to be typed instead of forcing it within the range of days within the current month (e.g. max 30 for June).  That change allows you to type "31" in when the month is "06", however as soon as you switch focus to the month part, the control detects the active part changed, tries to parse a DateTime out of it, and ends up coercing the "31" back to a "30".  This all happens in low-level generic PartEditBox logic so there's no easy way to work around it.

In the newer Editors we recently built for WinRT, we took a much simpler approach to editors where the editor is a freeform TextBox.  It doesn't restrict what you type as you type it, yet you can still do up/down arrow keys to increment part values.  The validation of the real backing DateTime occurs when you commit the value by either pressing Enter or losing focus.  That particular more "lightweight" design means that the issue you describe isn't a problem there.  Unfortunately we don't have lightweight variations of the editors in WPF though.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.