XamDateTimeEditor Class

Allows editing of date and/or time based on a mask.
Public Class XamDateTimeEditor 
   Inherits XamMaskedEditor
   Implements ISupportsSelectableText 
public class XamDateTimeEditor : XamMaskedEditor, ISupportsSelectableText  

XamDateTimeEditor can be used to edit a date and/or time. Based on the value of the XamMaskedEditor.Mask property, it can edit date, time or both date and time. The following are some example masks:

  • {date} - Date mask based on short date pattern setting of the system.
  • {time} - Time mask based on short time pattern setting of the system. Short time pattern typically does not include seconds portion.
  • {longtime} - Time mask based on long time pattern setting of the system. Long time pattern typically includes seconds portion.
  • {date} - Creates a date only mask based on the short date pattern.
  • {time} - Creates a time only mask based on the short time pattern.
  • {longtime} - Creates atime only mask based on the long time pattern, which typically includes seconds.
  • {date} {time} - Creates a date and time mask based on the short date and short time patterns.
  • mm/dd/yyyy - Creates a date only mask. Note: This mask specifies the exact order of day, month and year explicitly. The underlying culture settings will not be used to determine the order of day, month and year section.

See help for XamMaskedEditor.Mask property for a listing of all the supported masks, including ones that are relevant for date and time.

By default the current culture settings will be used to determine the format of date and time. However you can override that by setting the FormatProvider and Format properties. If FormatProvider is set then the mask and the formatting will be based on the settings provided by FormatProvider. Otherwise the formatting will be based on the current culture. Note: the Format property only controls what gets displayed when the control is not in edit mode. See Format for more information.

This examples demonstrates creating a XamDateTimeEditor.

Imports Infragistics.Windows.Editors

    Private Function CreateDateEditor() As XamDateTimeEditor
        Dim editor As New XamDateTimeEditor
        editor.AutoFillDate = AutoFillDate.MonthAndYear
        editor.DropDownButtonDisplayMode = DropDownButtonDisplayMode.Always
        editor.Mask = "{date}"
        Return editor
    End Function
using Infragistics.Windows.Editors;

        private XamDateTimeEditor CreateDateEditor()
            XamDateTimeEditor editor = new XamDateTimeEditor();
            editor.AutoFillDate = AutoFillDate.MonthAndYear;
            editor.DropDownButtonDisplayMode = DropDownButtonDisplayMode.Always;
            editor.Mask = "{date}";
            return editor;
Mask="{}{date}" />

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, 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