BinaryDatePicker
BinaryDatePicker control is an Outlook© style DatePicker control, which lets a user select a date from its custom Month/Year calendar (a fixed-font calendar), and to display that date in a specified format. Apart from providing the look-and-feel of Microsoft© Outlook© DatePicker object, the control class has rich and powerful features and is highly configurable too.
public class BinaryDatePicker : Control
Inherits from / implements: Control
Remarks
The BinaryDatePicker control is an Outlook© style DatePicker control, which lets a user select a date from its custom Month/Year calendar, and to display that date in a specified format.
To change the look of the calendar portion of the control, use various calendar specific properties exposed by the control.
The control's CustomFormat property sets the date format for the control.
The default date format is set to the "Long" format as specified in your Operating system date/time settings. You can set a different Date format, by setting the CustomFormat property with a custom format string. For more details, please see the control's CustomFormat property.
Members at a glance
BinaryDatePicker | Class constructor. |
BackColor | Gets or sets the backcolor for the text control portion (date display) of the control. |
BinaryCultureInfo | Gets or sets the CultureInfo to be used for the current instance of the control. |
BorderColor | Gets or sets the border color for the control's date displaying control's borders. |
CalendarForeColor | Gets or sets the color for the calendar's text forecolor (example - text forecolor for dates, days, etc.). |
CalendarInactiveDateForeColor | Gets or sets the color for the Inactive date(s) in the calendar for a given month/year. |
CalendarLegendDisplay | Gets or sets the legend display value, indicating whether or not the control should display in the calendar, a legend for various date markers. |
CalendarMonthAndYearTrackerColor | Gets or sets the color for painting the Month/Year tracker control in the control's calendar. |
CalendarMonthBackColor | Gets or sets the background color for the calendar. |
CalendarMonthTitleForeColor | Gets or sets the color for the Month/Year title string in the Calendar. |
CalenderDropDownArrowGlassRenderingColor | Gets or sets the color for drawing the dropdown arrow, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering. |
CalenderDropDownGlassRenderingEndColor | Gets or sets the end color for drawing the dropdown button window, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering. |
CalenderDropDownGlassRenderingStartColor | Gets or sets the start color for drawing the dropdown button window, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering. |
CloseButtonBackColor | Gets or sets the BackColor property for the control's drop-down calendar's "Close" button. |
CloseButtonFlatStyle | Gets or sets the FlatStyle property for the control's drop-down calendar's "Close" button. |
CloseButtonForeColor | Gets or sets the ForeColor property for the control's drop-down calendar's "Close" button. |
CloseButtonText | Gets or sets the text to be associated with the drop-down calendar's command button, that is used to close the calendar window. |
CustomDateXMLFeed | Gets or sets the path to an XML file containing the custom "named" date's name/value pair information. |
CustomDropDownImage | Gets or sets the custom image that will be drawn in the control's drop-down button portion. |
CustomFormat | Gets or sets the custom date format for displaying a date string in the control's text box, when the control's Format property is set to "Custom" (refer to BinaryDatePickerFormat for various available format values). |
DisplayTextState | Gets or sets the read-write/read-only state for the control's date display text box. |
DotBorderDepth | Gets or sets the painting depth (length/width) of the dotted border for the control's date displaying control. |
DotBorderGap | Gets or sets the painting gaps between the dots while drawing the dotted border for the control's date displaying control. |
DrawBorderAs | Gets or sets the border state of the control when drawing the control's date displaying control's border. |
DropWindowIsShowing | Whether the calendar drop-down is currently on screen. |
EditControlStyleIsExtended | Gets or sets the control's text box border style. |
EnableCustomDateXMLFeed | Gets or sets the value for enabling/disabling the XML based custom "named" dates facility. |
Font | Gets or sets the Font value for the BinaryDatePicker control's text control. |
ForeColor | Gets or sets the forecolor for the text control portion (date display) of the control. |
Format | Gets or sets the display format for the control. |
HostedFromChildContainer | Whether this picker is hosted inside another control rather than placed on a form directly. It is passed down to the calendar drop-down, which needs to know so it positions itself against the right window. |
IsReadOnly | Gets or sets a value indicating whether this instance is read-only. |
MarkSelectedDate | Gets or sets the value indicating whether a selected date (including today's date) can be marked, in the calendar, with a filled circle. |
MaxDateTime | Specifies the maximum date value of the control. |
MaxValue | Gets or sets the maximum date and time that can be selected in the control. |
MinDateTime | Specifies the minimum date value of the control. |
MinValue | Gets or sets the minimum date and time that can be selected in the control. |
NullDateString | Gets or sets the string to be displayed when the control's DateTime value is set to "Null". |
RenderDropDownButtonWithVisualStyles | Gets or sets whether to draw the calendar drop-down button using visual styles. |
SelectionDateEllipseColor | Gets or sets the circle fill color for a given selected date in the calendar. |
SelectionDateForeColor | Gets or sets the foreground color for a given selected date in the calendar. |
ShowBorderAlways | Gets or sets whether the control will always have its border displayed, even when the control is not currently in focus. |
ShowCustomMenu | Gets or sets whether the control's custom menu is displayed or not. |
ShowDropDownCalendarWindowAfterAdjustingForVirtualAvaliableScreenSpace | Gets or sets whether to adjust the display location of the drop-down calendar, when the BinaryDatePicker control is positioned in the form in such a location that when the container is run, there is no available space to display the drop-down calendar completely. |
ShowPopupOnEnter | Gets or sets whether to display the calender popup window upon entering the control. |
SpecialDates | Gets or sets a special range of dates that will highlighted in the drop-down colander window, indicating they are special. |
SpecialDatesFillColor | Gets or sets the Fill color for the special range of dates. Refer to SpecialDates property. |
SpecialDatesForeColor | Gets or sets the fore color for drawing the date text of dates from the range of those defined special dates. Refer to SpecialDates property. |
TodayButtonBackColor | Gets or sets the BackColor property for the control's drop-down calendar's "Today" button. |
TodayButtonFlatStyle | Gets or sets the FlatStyle property for the control's drop-down calendar's "Today" button. |
TodayButtonForeColor | Gets or sets the ForeColor property for the control's drop-down calendar's "Today" button. |
TodayButtonText | Gets or sets the text to be associated with the Calendar's command button, that is used to set the date to Today's date. |
TodayCloseButtonsAreVisible | Gets or sets whether the "Today" and "Close" buttons are visible when the control's drop-down calendar is displayed. |
TodayEllipseColor | Gets or sets the circle fill color for "Today's" date, if it appears in the calendar. |
TodayForeColor | Gets or sets the foreground color for the "today's" date, if it appears in the calendar. |
UseDropDownImageStyle | Gets or sets the style to use, to draw the image in the control's drop-down button portion. |
Value | Gets or sets the date/time value assigned to the control. |
ValueIsNull | Gets or sets whether the DateTime Value of the control is set to a "null" state value. |
Dispose | — |
OnEnter | Raises the Enter event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior. |
OnFontChanged | Raises the FontChanged event, passing the new font on to the calendar. |
OnLeave | protected method - not exposed! |
OnMouseDown | Protected method - not exposed! |
OnMouseLeave | Raises the MouseLeave event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior. |
OnMouseMove | Raises the MouseMove event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior. |
OnMouseUp | Protected method - not exposed! |
OnPaint | Protected method - not exposed! |
OnResize | Protected method - not exposed! |
OnSystemColorsChanged | protected event - not exposed! |
SelectControlText | Performs a "Select All" of the existing text in the control's text input area. |
BinaryCalendarAboutToBeActivated | This event is raised when the drop-down calendar is about to be displayed. |
BinaryCalendarActivated | Occurs when the drop-down calendar is shown (activated for display). |
BinaryCalendarDeactivated | Occurs when the drop-down calendar is deactivated (i.e. when the drop-down calendar is closed) |
BinaryDateAboutToBeChanged | The event raised when the date value is about to be changed in the control. |
BinaryDateChanged | Occurs when the control's date/time value is changed. |
CustomFormatDateChanged | The event raised when the date value is changed in the control when the Format is set to Custom. |
MouseIsOverADate | This event is raised when the user points the mouse pointer over a date in the drop-down calander. |
UserDateCustomValidating | Attach your custom validation handler to validate user typed date. |
Constructors
BinaryDatePicker
Class constructor.
Properties
BackColor
Gets or sets the backcolor for the text control portion (date display) of the control.
Value. A Color value for the date displaying text control portion of the control.
Color. Note:- Setting this property will not change the backcolor of the dropdown calendar of this control.
This property will only set the backcolor property of the text control portion of the control. The default
Color value for this property is Window value.BinaryCultureInfo
Gets or sets the CultureInfo to be used for the current instance of the control.
CurrentCulture to display date/time and its drop-down calendar. If for any reason, you want to specifically set the control's culture to use a different CultureInfo value (say you want to use "fr-FR" CultureInfo in a system with default CultureInfo pointing to "en-GB"), then you can set this property with that specific value, to let the control use that specific culture for its current instance.BorderColor
Gets or sets the border color for the control's date displaying control's borders.
Highlight color value. Note: This property is applicable only when the control is in the ExtendedStyle mode (Refer
EditControlStyleIsExtended).CalendarForeColor
Gets or sets the color for the calendar's text forecolor (example - text forecolor for dates, days, etc.).
CalendarInactiveDateForeColor
Gets or sets the color for the Inactive date(s) in the calendar for a given month/year.
Value. A Color value.
ControlDark color value.CalendarLegendDisplay
Gets or sets the legend display value, indicating whether or not the control should display in the calendar, a legend for various date markers.
Value. A bool value indicating whether legend display facility is on or off.
CalendarMonthAndYearTrackerColor
Gets or sets the color for painting the Month/Year tracker control in the control's calendar.
Value. A Color value.
CalendarMonthAndYearTrackerColor property.CalendarMonthBackColor
Gets or sets the background color for the calendar.
CalendarMonthTitleForeColor
Gets or sets the color for the Month/Year title string in the Calendar.
CalenderDropDownArrowGlassRenderingColor
Gets or sets the color for drawing the dropdown arrow, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering.
CalenderDropDownGlassRenderingEndColor
Gets or sets the end color for drawing the dropdown button window, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering.
CalenderDropDownGlassRenderingStartColor
Gets or sets the start color for drawing the dropdown button window, when the UseDropDownImageStyle is set to DropDownImageStyle.GlassRendering.
CloseButtonBackColor
Gets or sets the BackColor property for the control's drop-down calendar's "Close" button.
CloseButtonFlatStyle
Gets or sets the FlatStyle property for the control's drop-down calendar's "Close" button.
CloseButtonForeColor
Gets or sets the ForeColor property for the control's drop-down calendar's "Close" button.
CloseButtonText
Gets or sets the text to be associated with the drop-down calendar's command button, that is used to close the calendar window.
By default, this command button has the text "Close" in English language.
If you want to change this text to display "Close" in another language convenient to your user, then you can set this property with a
string pointing to another language equivalent of the english word "Close". Note: The command button size is a fixed size of Size(47,20).
Hence ensure the new text you will be assigning to this property is within this size range, to display the text properly.
CustomDateXMLFeed
Gets or sets the path to an XML file containing the custom "named" date's name/value pair information.
Value. The location of an XML file containing the custom date names and values. The default value is Empty.
Value property will be set to this date value accordingly. NOTE : Remember, the XML date data (i.e. the dates you will define in the XML document) will be parsed based on the Current culture of the thread.
But if you have specified any specific
CultureInfo, by setting the BinaryCultureInfo property, then the dates specified in the XML file will be parsed based on that specified CultureInfo. The required format of the XML file is described below.
You can cut and paste the below XML format and save the content as an XML file, for example, as CustomDates.xml (as is used in the demonstration program), and then you can change the contents of the file with your own custom dates and values.
The following XML content illustrates the expected XML file format :- <?xml version="1.0" encoding="utf-8" ?> <CustomDates> <DateLookup> <DateName>Corporate day</DateName> <DateValue>14/03/2003</DateValue> </DateLookup> <DateLookup> <DateName>Shareholder's day</DateName> <DateValue>16/03/2003</DateValue> </DateLookup> <DateLookup> <DateName>Agenda date</DateName> <DateValue>15/03/2003</DateValue> </DateLookup> <DateLookup> <DateName>Settlement date</DateName> <DateValue>25/11/2003</DateValue> </DateLookup> <DateLookup> <DateName>Customer day</DateName> <DateValue>03/03/2003</DateValue> </DateLookup> <DateLookup> <DateName>Project release day</DateName> <DateValue>21/03/2003</DateValue> </DateLookup> </CustomDates> <HighlightDates> <Date>18/09/2007</Date> <Date>17/09/2007</Date> <Date>14/09/2007</Date> <Date>15/09/2007</Date> </HighlightDates>
CustomDropDownImage
Gets or sets the custom image that will be drawn in the control's drop-down button portion.
UseDropDownImageStyle to DropDownImageStyle.CustomImage and then set this property to an image of size 11 x 13 (width 11, height 13). Note: If your specified image is not of size 11 x 13, then the built-in calendar image will be used to draw instead.
CustomFormat
Gets or sets the custom date format for displaying a date string in the control's text box, when the control's Format property is set to "Custom" (refer to BinaryDatePickerFormat for various available format values).
Value. A string that represents the custom date-time format.
DateTimeFormatInfo type to specify a valid "custom" date pattern string to set this property. For example, to display the date as "March 27 2001 at 12 AM", set the CustomFormat property to "MMMM dd yyyy 'at' hh tt". By default, this property is set to the "Long" date/time format as per the culture of the current thread.DisplayTextState
Gets or sets the read-write/read-only state for the control's date display text box.
DotBorderDepth
Gets or sets the painting depth (length/width) of the dotted border for the control's date displaying control.
DrawBorderAs property to "Dotted" (refer BorderState), the control is drawn with a dotted border. You can set the depth of each of the dotted border part, by setting this property. This property determines the length/width of each of the dot, while drawing the border.
By default, this property is set to integer (int) value of 4.
DotBorderGap
Gets or sets the painting gaps between the dots while drawing the dotted border for the control's date displaying control.
DrawBorderAs property to "Dotted" (refer BorderState), the control is drawn with a dotted border. You can set the gap between each of the dotted border part by setting this property. This property determines the length of gap between each dot, while drawing the border.
By default, this property is set to integer (int) value of 5.
DrawBorderAs
Gets or sets the border state of the control when drawing the control's date displaying control's border.
EditControlStyleIsExtended mode. Basically, there are two different states available for drawing the control's border, while in
EditControlStyleIsExtended. - Normal border - This is a
BorderStatewhen the control's border is drawn using a continuous line. - Dotted border - This is a
BorderStatewhen the control's border is drawn as a dotted border.
If you want the control's border to be drawn as a dotted border, you should set this property to the appropriate value, viz., "BinaryDatePicker.BorderState.Dotted".
If you want the control's border to be drawn as a regular un-dotted line, set this property to "BinaryDatePicker.BorderState.Normal".
DropWindowIsShowing
Whether the calendar drop-down is currently on screen.
EditControlStyleIsExtended
Gets or sets the control's text box border style.
One is the standard Windows text box style and the other is a text box with the Windows© XP© style text box borders.
Also, when you set the property to true, the control additionally supports a hovering mechanism for the text box, i.e., when the mouse pointer is brought into the text box area, the borders change to the XP style borders, and when the text box loses input focus, the borders change to a different state indicating that the control has lost focus.
This is similar to the behaviour that you can see in the MSDN© edit/combo controls.
When you set this property to true, please note that, by default
DrawBorderAs property is set to "BinaryDatePicker.BorderState.Normal". By default, this property is set to false.EnableCustomDateXMLFeed
Gets or sets the value for enabling/disabling the XML based custom "named" dates facility.
CustomDateXMLFeed facility. By default, this property is set to false.Font
Gets or sets the Font value for the BinaryDatePicker control's text control.
ForeColor
Gets or sets the forecolor for the text control portion (date display) of the control.
Value. A Color value for the date displaying text control portion of the control.
Color. Note:- Setting this property will not change the forecolor of the dropdown calendar of this control. This property will only set the forecolor property of the text control portion of the control. The default
Color value for this property is WindowText value.Format
Gets or sets the display format for the control.
Value. A BinaryDatePickerFormat enum.
BinaryDatePickerFormat enum to specify a valid date/time display format. For example, if you set this property to "Long", the date will displayed using the Long date format as specified in your computer's Operating system.HostedFromChildContainer
Whether this picker is hosted inside another control rather than placed on a form directly. It is passed down to the calendar drop-down, which needs to know so it positions itself against the right window.
IsReadOnly
Gets or sets a value indicating whether this instance is read-only.
MarkSelectedDate
Gets or sets the value indicating whether a selected date (including today's date) can be marked, in the calendar, with a filled circle.
Note: When this value to set to false, the control's another property
CalendarLegendDisplay is also set to false automatically. Remember this when setting this property to false.
MaxDateTime
Specifies the maximum date value of the control.
Value. The maximum date is set to 31/12/9999 00:00:00.
MaxValue
Gets or sets the maximum date and time that can be selected in the control.
Value. The maximum date and time that can be selected in the control. The default is 31/12/9999 00:00:00.
MinDateTime
Specifies the minimum date value of the control.
Value. The minimum date is set to 1/2/0001 00:00:00.
MinValue
Gets or sets the minimum date and time that can be selected in the control.
Value. The minimum date and time that can be selected in the control. The default is 1/2/0001 00:00:00.
NullDateString
Gets or sets the string to be displayed when the control's DateTime value is set to "Null".
Value. A string value.
DBNull or when the user clears the date displaying text control to blank (i.e he is setting the control's DateTime value to null), the textbox portion of the control will display a text string representing the Null state. This "Null date" representing string is the value of this property. By default, this property is set to
Empty. You can override this text string and set your own string, based on your own needs or convenience.
Say, for example, you may like to set it to "No date selected!". To achieve this, set this property with an appropriate
string value. RenderDropDownButtonWithVisualStyles
Gets or sets whether to draw the calendar drop-down button using visual styles.
SelectionDateEllipseColor
Gets or sets the circle fill color for a given selected date in the calendar.
Color value. By default, this property is set to Blue.SelectionDateForeColor
Gets or sets the foreground color for a given selected date in the calendar.
Color value. By default, this property is set to Yellow.ShowBorderAlways
Gets or sets whether the control will always have its border displayed, even when the control is not currently in focus.
Note: This property has effect only when the control is in extended mode (refer
EditControlStyleIsExtended). ShowDropDownCalendarWindowAfterAdjustingForVirtualAvaliableScreenSpace
Gets or sets whether to adjust the display location of the drop-down calendar, when the BinaryDatePicker control is positioned in the form in such a location that when the container is run, there is no available space to display the drop-down calendar completely.
ShowPopupOnEnter
Gets or sets whether to display the calender popup window upon entering the control.
SpecialDates
Gets or sets a special range of dates that will highlighted in the drop-down colander window, indicating they are special.
SpecialDatesFillColor
Gets or sets the Fill color for the special range of dates. Refer to SpecialDates property.
SpecialDatesForeColor
Gets or sets the fore color for drawing the date text of dates from the range of those defined special dates. Refer to SpecialDates property.
TodayButtonBackColor
Gets or sets the BackColor property for the control's drop-down calendar's "Today" button.
TodayButtonFlatStyle
Gets or sets the FlatStyle property for the control's drop-down calendar's "Today" button.
TodayButtonForeColor
Gets or sets the ForeColor property for the control's drop-down calendar's "Today" button.
TodayButtonText
Gets or sets the text to be associated with the Calendar's command button, that is used to set the date to Today's date.
By default, this command button has the text "Today" in English language.
If you want to change this text to display "Today" in another language convenient to your user, then you can set this property with a
string pointing to another language equivalent of the english word "Today". Note: The command button size is a fixed size of Size(47,20).
Hence ensure the new text you will be assigning to this property is within this size range, to display the text properly.
TodayCloseButtonsAreVisible
Gets or sets whether the "Today" and "Close" buttons are visible when the control's drop-down calendar is displayed.
TodayEllipseColor
Gets or sets the circle fill color for "Today's" date, if it appears in the calendar.
Green) to mark the selected date. You can change this and set a special color to that circle that is drawn around the date. To achieve this, set this property to a Color value.TodayForeColor
Gets or sets the foreground color for the "today's" date, if it appears in the calendar.
Color value. By default, this property is set to Yellow.UseDropDownImageStyle
Gets or sets the style to use, to draw the image in the control's drop-down button portion.
CustomDropDownImage for more details.Value
Gets or sets the date/time value assigned to the control.
Note: When the current value of this property is null or
DBNull, this property returns the value of the NullDateString property. Also note that the property is of type
Object and hence whenever you set or get this property, please remember to explicitly cast it to the relevant type i.e., Object or DateTime respectively.ValueIsNull
Gets or sets whether the DateTime Value of the control is set to a "null" state value.
Methods
Dispose
No summary in the source yet.
- disposing
OnEnter
Raises the Enter event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnFontChanged
Raises the FontChanged event, passing the new font on to the calendar.
- e
- The data for the event.
OnLeave
protected method - not exposed!
- e
OnMouseDown
Protected method - not exposed!
- e
OnMouseLeave
Raises the MouseLeave event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnMouseMove
Raises the MouseMove event. BinaryDatePicker overrides it so the control's own handling runs alongside the base behavior.
- e
- The data for the event.
OnMouseUp
Protected method - not exposed!
- e
OnPaint
Protected method - not exposed!
- e
OnResize
Protected method - not exposed!
- e
OnSystemColorsChanged
protected event - not exposed!
- e
SelectControlText
Performs a "Select All" of the existing text in the control's text input area.
Events
BinaryCalendarAboutToBeActivated
This event is raised when the drop-down calendar is about to be displayed.
TopMost property set to true, you will need to reset your form instance's TopMost property to false from the time the drop-down calendar is displayed, and until the calendar is closed/deactivated. To ensure this is correctly automated, you are advised to subscribe this event
BinaryCalendarAboutToBeActivated, and in this event's handler, set the hosting Forms's TOpMost property to false. Once the calendar is closed, you can re-set your hosting form instance's TopMost property to true again, by setting that property to true, in this control's
BinaryCalendarDeactivated event.BinaryCalendarActivated
Occurs when the drop-down calendar is shown (activated for display).
BinaryCalendarDeactivated
Occurs when the drop-down calendar is deactivated (i.e. when the drop-down calendar is closed)
BinaryDateAboutToBeChanged
The event raised when the date value is about to be changed in the control.
BinaryDateChanged
Occurs when the control's date/time value is changed.
Value property gets changed to a valid DateTime value (i.e. either when a date is selected from the dropdown month/year Calendar or when the Value property is specificially changed).
CustomFormatDateChanged
The event raised when the date value is changed in the control when the Format is set to Custom.
MouseIsOverADate
This event is raised when the user points the mouse pointer over a date in the drop-down calander.
UserDateCustomValidating
Attach your custom validation handler to validate user typed date.