Table of Contents

Class DateTextProvider

Namespace
Terminal.Gui.Views
Assembly
Terminal.Gui.dll

Date input provider for TextValidateField. Provides date editing with culture-aware formatting.

public class DateTextProvider : ITextValidateProvider
Inheritance
DateTextProvider
Implements
Inherited Members

Remarks

This provider parses the ShortDatePattern to determine:

<ul><li>Field order (year, month, day) based on culture</li><li>Date separator character</li><li>Dynamic field width based on pattern</li></ul>

The cursor automatically skips over separator characters during navigation. Date values are auto-corrected to valid ranges (e.g., day clamped to days-in-month).

Constructors

DateTextProvider()

Initializes a new instance of the DateTextProvider class.

Properties

DateValue

Gets or sets the current date value.

DisplayText

Gets the formatted string for display.

Fixed

Set that this provider uses a fixed width. e.g. Masked ones are fixed.

Format

Gets or sets the DateTimeFormatInfo used for date formatting.

IsValid

True if the input is valid, otherwise false.

Text

Set the input text and get the current value.

Methods

Cursor(int)

Set Cursor position to pos.

CursorEnd()

Find the last valid character position.

CursorLeft(int)

First valid position before pos.

CursorRight(int)

First valid position after pos.

CursorStart()

Find the first valid character position.

Delete(int)

Deletes the current character in pos.

InsertAt(char, int)

Insert character ch in position pos.

OnTextChanged(EventArgs<string>)

Called when the text has changed. Subclasses can override this to perform custom actions.

Events

TextChanged

Changed event, raised when the text has changed. This event is raised when the Text changes. The passed EventArgs is a string containing the old value.