InvalidTextBehavior Property

Determines what happens when the control is validated and the text cannot be converted to a valid date.
Public Property InvalidTextBehavior As InvalidTextBehavior
public InvalidTextBehavior InvalidTextBehavior {get; set;}

When the user enters text in the UltraDateTimeEditor, then the control will validate that text when in the Leave or Validating events. If the text cannot be converted to a valid date, the control must revert the value to a valid date. This property determines whether the control will use the last valid date that was entered as the user typed, or the the original value when the control was entered.

When set to 'PreserveWhileInEditMode', the user input is left intact until the control is allowed to exit edit mode, or passes validation. This is useful in scenarios where, for example, it is desirable to leave unpopulated mask placeholders intact, so that after an error message is displayed and focus returns to the control, the user can see why the input was rejected and continue editing with previously entered characters left as they were entered.

The 'PreserveWhileInEditMode' setting is only applicable in scenarios where the control's BeforeExitEditMode event is conditionally canceled, or, in the case where AlwaysInEditMode is set to true, the Validating event is conditionally canceled. In these situations, the 'PreserveWhileInEditMode' setting will prevent the control's value from reverting to the last valid value when the validation fails, which in turn preserves the edit portion's contents, effectively allowing the user to continue editing the value without losing previously entered characters.

The 'PreserveWhileInEditMode' setting does not prevent partially entered years from being automatically resolved; this is goverened by the system's two digit year rule. When two digits or three digits are entered for a four digit year section, the four year value is automatically resolved by the control.


Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also