HypernovaDesktop Components · docs
Binarymission
WinForms › Date Picker

Date Picker

.NET Framework 4.8.NET 6 / 8 / 10v3.0.1WinForms

A date field with a drop-down month calendar, in the manner of Outlook's date pickers: the user types a date, picks one from the calendar, or steps it with the keyboard – for order dates, due dates, dates of birth.

11public types
105public members
1namespaces

Assembly

AssemblyBinarymission.WinForms.Controls.BinaryDatePicker.dll
Root namespaceBinarymission.WinForms.Controls.DateTimeControls
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10
Depends onBinaryExtendedText, BinaryToolTip

Overview

What it is for

The control is a text box and a drop-down button. The text is free text written in Format (the long date by default) or CustomFormat, and is read back as the user types. It also understands today, yesterday, tomorrow, one week from now and one week before now, and names of your own from an XML file (CustomDateXMLFeed).

Keyboard and menu

In the text: Enter commits what was typed, Up and Down move the date a month, Page Up and Page Down a year, Ctrl+A and Ctrl+S a day forward and back, and Ctrl+L (with the menu on) opens the calendar. In the calendar: the arrows move a day or a week, Page Up and Page Down a month, Home and End to the ends of the month, Enter chooses and Escape closes. The right-click menu (ShowCustomMenu) adds clipboard commands and quick dates.

The value

Value is an object: a DateTime, or – with no date (ValueIsNull) – NullDateString, or DBNull when the control is data bound. MinValue and MaxValue limit it. BinaryDateChanged reports each change.

Appearance

The text box's border is set by EditControlStyleIsExtended, BorderColor and DrawBorderAs; the button by UseDropDownImageStyle; the calendar by the Calendar..., Selection... and Today... colours, SpecialDates and Font, from which it is sized.

Getting started

using System;
using System.Drawing;
using System.Windows.Forms;
using Binarymission.WinForms.Controls.DateTimeControls;

var dueDate = new BinaryDatePicker
{
    Location = new Point(16, 16),
    Width = 220,
    Format = BinaryDatePickerFormat.Custom,
    CustomFormat = "ddd dd MMM yyyy",
    MinValue = DateTime.Today,
    NullDateString = "No due date",
    SpecialDates = new[] { new DateTime(2026, 12, 25), new DateTime(2026, 12, 26) }
};

dueDate.Value = DateTime.Today.AddDays(30);
dueDate.BinaryDateChanged += (sender, e) =>
    invoice.DueDate = dueDate.ValueIsNull ? (DateTime?)null : (DateTime)dueDate.Value;

invoiceForm.Controls.Add(dueDate);

API reference

Binarymission.WinForms.Controls.DateTimeControls

class BinaryDatePickerA date field with a drop-down month calendar, in the manner of Outlook's date pickers: the user types a date, picks one from the calendar, or steps it with the keyboard - for order dates, due dates, dates of birth.
delegate CustomFormatDateChangeHandlerRepresents the method that handles CustomFormatDateChanged.
delegate CustomValidatorRepresents the method that handles UserDateCustomValidating.
delegate DateChangePreHandlerRepresents the method that handles BinaryDateAboutToBeChanged.
delegate MouseOverADateHandlerRepresents the method that handles MouseIsOverADate.
enum BinaryDatePickerFormatSpecifies the format a BinaryDatePicker writes its date in.
enum BinaryToolTipStyleSpecifies the shape of a tooltip shown for a day in a BinaryDatePicker's calendar.
enum BorderStateSpecifies how the border of a BinaryDatePicker's text box is drawn.
class DateInfoDescribes the day under the pointer in the calendar, for MouseIsOverADate.
class DateToolTipInfoThe tooltip to show for a day in the calendar, filled in by a MouseIsOverADate handler.
enum DropDownImageStyleSpecifies what a BinaryDatePicker draws on its drop-down button.