Show / Hide Table of Contents

# Class DateField

Simple Date editing View

##### Inheritance

System.Object
Responder
View
TextField
DateField

##### Implements

System.Collections.IEnumerable

##### Inherited Members

TextField.Used
TextField.ReadOnly
TextField.TextChanged
TextField.OnLeave()
TextField.Frame
TextField.Text
TextField.Secret
TextField.CursorPosition
TextField.PositionCursor()
TextField.Redraw(Rect)
TextField.CanFocus
TextField.SelectedStart
TextField.SelectedLength
TextField.SelectedText
TextField.ClearAllSelection()
TextField.Copy()
TextField.Cut()
TextField.Paste()
View.Enter
View.Leave
View.MouseEnter
View.MouseLeave
View.MouseClick
View.Driver
View.Subviews
View.Id
View.IsCurrentTop
View.WantMousePositionReports
View.WantContinuousButtonPressed
View.GetEnumerator()
View.LayoutStyle
View.Bounds
View.X
View.Y
View.Width
View.Height
View.SuperView
View.SetNeedsDisplay()
View.SetNeedsDisplay(Rect)
View.ChildNeedsDisplay()
View.Add(View)
View.Add(View[])
View.RemoveAll()
View.Remove(View)
View.BringSubviewToFront(View)
View.SendSubviewToBack(View)
View.SendSubviewBackwards(View)
View.BringSubviewForward(View)
View.Clear()
View.Clear(Rect)
View.ScreenToView(Int32, Int32)
View.ClipToBounds()
View.SetClip(Rect)
View.DrawFrame(Rect, Int32, Boolean)
View.DrawHotString(ustring, Attribute, Attribute)
View.DrawHotString(ustring, Boolean, ColorScheme)
View.Move(Int32, Int32)
View.HasFocus
View.OnEnter()
View.Focused
View.MostFocused
View.ColorScheme
View.AddRune(Int32, Int32, Rune)
View.ClearNeedsDisplay()
View.DrawContent
View.OnDrawContent(Rect)
View.SetFocus(View)
View.KeyPress
View.ProcessHotKey(KeyEvent)
View.ProcessColdKey(KeyEvent)
View.KeyDown
View.OnKeyDown(KeyEvent)
View.KeyUp
View.OnKeyUp(KeyEvent)
View.EnsureFocus()
View.FocusFirst()
View.FocusLast()
View.FocusPrev()
View.FocusNext()
View.LayoutComplete
View.LayoutSubviews()
View.ToString()
View.OnMouseEnter(MouseEvent)
View.OnMouseLeave(MouseEvent)
View.OnMouseEvent(MouseEvent)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)

###### Namespace: Terminal.Gui

###### Assembly: Terminal.Gui.dll

##### Syntax

    public class DateField : TextField, IEnumerable

##### Remarks

The DateField View provides date editing functionality with mouse support.

### Constructors

#### DateField()

Initializes a new instance of DateField using Computed layout.

##### Declaration

    public DateField()

#### DateField(DateTime)

Initializes a new instance of DateField using Computed layout.

##### Declaration

    public DateField(DateTime date)

##### Parameters

Type | Name | Description
--- | --- | ---
System.DateTime | date |

#### DateField(Int32, Int32, DateTime, Boolean)

Initializes a new instance of DateField using Absolute layout.

##### Declaration

    public DateField(int x, int y, DateTime date, bool isShort = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | x | The x coordinate.
System.Int32 | y | The y coordinate.
System.DateTime | date | Initial date contents.
System.Boolean | isShort | If true, shows only two digits for the year.

### Fields

#### DateChanged

DateChanged event, raised when the Date property has changed.

##### Declaration

    public Action<DateTimeEventArgs<DateTime>> DateChanged

##### Field Value

Type | Description
--- | ---
System.Action<DateTimeEventArgs<System.DateTime>> |

##### Remarks

This event is raised when the Date property changes.

### Properties

#### Date

Gets or sets the date of the DateField.

##### Declaration

    public DateTime Date { get; set; }

##### Property Value

Type | Description
--- | ---
System.DateTime |

##### Remarks

#### IsShortFormat

Get or set the date format for the widget.

##### Declaration

    public bool IsShortFormat { get; set; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

### Methods

#### MouseEvent(MouseEvent)

Method invoked when a mouse event is generated

##### Declaration

    public override bool MouseEvent(MouseEvent ev)

##### Parameters

Type | Name | Description
--- | --- | ---
MouseEvent | ev |

##### Returns

Type | Description
--- | ---
System.Boolean | `true`, if the event was handled, `false` otherwise.

##### Overrides

TextField.MouseEvent(MouseEvent)

#### OnDateChanged(DateTimeEventArgs<DateTime>)

Event firing method for the DateChanged event.

##### Declaration

    public virtual void OnDateChanged(DateTimeEventArgs<DateTime> args)

##### Parameters

Type | Name | Description
--- | --- | ---
DateTimeEventArgs<System.DateTime> | args | Event arguments

#### ProcessKey(KeyEvent)

Processes key presses for the TextField.

##### Declaration

    public override bool ProcessKey(KeyEvent kb)

##### Parameters

Type | Name | Description
--- | --- | ---
KeyEvent | kb |

##### Returns

Type | Description
--- | ---
System.Boolean |

##### Overrides

TextField.ProcessKey(KeyEvent)

##### Remarks

The TextField control responds to the following keys:

Keys | Function
--- | ---
Delete, Backspace | Deletes the character before cursor.

### Implements

System.Collections.IEnumerable