Version

Using xamDateTimeInput

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.

Purpose

This topic demonstrates how to add a xamDateTimeInput™ control to your application and use some of its more notable properties.

Required background

You need to first read the following topics:

xamDateTimeInput Configuration Overview

Control configuration chart

The table below lists some of the configurable behaviors of the xamDateTimeInput control.

Configurable behavior

Configuration details

Configuration properties

Steps needed to add a xamDateTimeInput control to an application.

none

Configure some of the main properties of the control.

Adding xamDateTimeInput to an application

  1. Add the Infragistics namespace.

    1. Add required references

      In order to add a xamDateTimeInput control to your application you must add the following assemblies to your project:

      • InfragisticsWPF.dll

      • InfragisticsWPF.Controls.Editors.XamCalendar.dll

      • InfragisticsWPF.Controls.Editors.XamDateTimeInput.dll

      • InfragisticsWPF.Controls.Editors.XamMaskedInput.dll

    2. Add the Infragistics namespace

      In XAML:

      xmlns:ig="http://schemas.infragistics.com/xaml"

      In Visual Basic:

      Imports Infragistics.Controls.Editors

      In C#:

      using Infragistics.Controls.Editors;
  1. Add a xamDateTimeInput control.

    In XAML:

    <ig:XamDateTimeInput/>

    In Visual Basic:

    Dim input As XamDateTimeInput = New XamDateTimeInput()

    In C#:

    XamDateTimeInput DateTimeInput = new XamDateTimeInput();

Modifying the xamDateTimeInput

The table below maps the desired configurations to property settings. The properties are directly accessed from the xamDateTimeInput control.

In order to…

Use this property:

And set it to…

A string of your choosing

DisplayErrorMessage

MonthAndYear

Always

Always/Focused/MouseOver

A string with one of the following patterns: y #m #d #h, where ‘’ is the number of years, months etc. by which the value will be incremented/decremented

True/False

Modifying the xamDateTimeInput details

  1. 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:

    In XAML:

    <ig:XamDateTimeInput Mask=”[Your Mask]”/>

    In Visual Basic:

    DateTimeInput.Mask = ”[Your Mask]”

    In C#:

    DateTimeInput.Mask = ”[Your Mask]”;

    For more information on how to create a mask, please refer to the Masks.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

  1. 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.

    Note
    Note

    Disabling the IsUndoEnabled property clears the undo/redo stack. If you disable undo/redo and then re-enable it, the commands won’t work because the undo/redo history is cleared.

Modifying the xamDateTimeInput example

The images below demonstrate a xamDateTimeInput control in edit and display mode as a result of the following settings:

Property

Setting

mm/dd/yyyy hh:mm:ss

DisplayErrorMessage

MonthAndYear

Always

Focused

1m

In edit mode:

In display mode:

xamInputs xamDateTimeInput Using 2.png
xamInputs xamDateTimeInput Using 1.png

Modifying the xamDateTimeInput property reference

For detailed information about these properties, refer to their listing in the property reference section: