We recommend that you use the XamDateTimeEditor control instead of the xamDateTimeInput control. The xamDateTimeInput is being planned for retirement over the next few years and will not receive any new features. We will continue to provide support and critical bug fixes for the xamDateTimeInput during this time. For help or questions on migrating your codebase to the xamDateTimeEditor, please contact support.
This topic demonstrates how to add a xamDateTimeInput™ control to your application and use some of its more notable properties.
The table below lists some of the configurable behaviors of the xamDateTimeInput control.
Add the Infragistics namespace.
Add required references
In order to add a xamDateTimeInput control to your application you must add the following assemblies to your project:
Add the Infragistics namespace
In Visual Basic:
Add a xamDateTimeInput control.
In Visual Basic:
Dim input As XamDateTimeInput = New XamDateTimeInput()
XamDateTimeInput DateTimeInput = new XamDateTimeInput();
The table below maps the desired configurations to property settings. The properties are directly accessed from the xamDateTimeInput control.
Set a Mask.
The most important part of setting up an input control is configuring the Mask property. Set a mask that suits your needs by:
<ig:XamDateTimeInput Mask=”[Your Mask]”/>
In Visual Basic:
DateTimeInput.Mask = ”[Your Mask]”
DateTimeInput.Mask = ”[Your Mask]”;
For more information on how to create a mask, please refer to the Masks.
Display error message when invalid value is entered.
There are several options for how the xamDateTimeInput behaves when an invalid value is entered by the user. If you set the InvalidValueBehavior property to DisplayErrorMessage, every time the user enters an invalid value and tries to leave the input control, an error message containing error details is displayed.
Make the xamDateTimeInput fill the month and year automatically.
If the AutoFillDate property is set to MonthAndYear, when the user enters a value in the day part of a date and then leaves the control, the month and year part are automatically filled with the current month and year. Analogically if the AutoFillDate is set to Year, when the day and month are filled and the user leaves the control, the year is automatically filled.
Always display the calendar drop down button.
By default the calendar drop down button is displayed on mouse/pointer over. If you want it to always be visible, set the DropDownButtonDisplayMode to Always. A third option, Focused, is also available which displays the calendar drop down button only when the control has the input focus.
Display buttons for incrementing/decrementing the value.
If you want to display buttons for incrementing or decrementing the value of the xamDateTimeInput you need to set the SpinButtonDisplayMode to Always, Focused, or MouseOver.
Change the increment value.
If you don’t specify the SpinIncrement property, the part of the date/time where the text cursor is, will increment/decrement by 1. For example if the text cursor is in the seconds part of a date time value and the user clicks the increment button, the value will be incremented by one second. However you are able to specify a specific value for the SpinIncrement, for example two days. You can achieve this by setting the SpinIncrement to “2d”. The other possible patterns are shown in the property settings table above. Also in code behind you can set the SpinIncrement property to a specific TimeSpan struct object.
Enable/disable undo/redo operations.
By default, the xamInputs support undo/redo operations triggered by CTRL+Z and CTRL + Y keys combinations. If you want to disable this functionality, you can set the IsUndoEnabled property to False.
The images below demonstrate a xamDateTimeInput control in edit and display mode as a result of the following settings:
Following are some other topics you may find useful.