DateFormField Class
- Namespace
TXTextControl
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTextControl. WPF. SDK
- Assembly
TXTextControl.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTextControl. WPF. SDK TXTextControl.from the setup.dll
Description
An object of the DateFormField class represents a date field on a form. It can be initially empty and it can have a horizontal extension, when it is empty. When a date field is clicked or entered through the keyboard's arrow keys a date control is shown where the user can select a date. When the date field is clicked again or the Escape key is pressed the date control is removed and the user can insert or change the date with the keyboard. The date is formatted depending on the culture used for the text of the date field. When a date field is inserted at a position without a set culture, a TextControl uses the system language to select a culture. Supported formats for a certain language can be obtained through the DateFormField.SupportedDateFormats property and can be set with the DateFormField.DateFormat property. When the DateFormat property is an empty string, which is the default, the culture's default format is used. A user can also insert or change a date with the keyboard, then the TextControl tries to parse the inserted date depending on the specified format and culture and automatically formats the date. When parsing is not possible the previous date is restored.
Syntax
public class DateFormField : FormFieldPublic Class DateFormField
Inherits FormFieldExamples
The following example adds a prefilled delivery-date field to a form.
DateFormField dateFormField = new(DateTime.Today.AddDays(14), 0) { Name = "DeliveryDate" };
textControl.FormFields.Add(dateFormField);Dim dateFormField As New DateFormField(Date.Today.AddDays(14), 0) With { .Name = "DeliveryDate" }
textControl.FormFields.Add(dateFormField)Members
Constructors
| Constructor | Description |
|---|---|
| DateFormField | Initializes a new instance of the DateFormField class. |
Properties
| Property | Description |
|---|---|
| Date | Gets or sets the DateFormField's date. |
| DateFormat | Gets or sets the date's format. For a certain DateFormField the format string should be one of the strings returned through the SupportedDateFormats property. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date. When this property is an empty string, which is the default value, a default format is used depending on the culture set for the date field's text. |
| DescriptiveText | Gets or sets a descriptive text for a form field. An empty string indicates that the form field has no such text. An empty string can also be used to delete a previously set text. (Inherited from FormField.) |
| EmptyWidth | Gets or sets the horizontal extension, in twips, of the DateFormField, when a date is not set. |
| Enabled | Gets or set a value indicating whether the form field is enabled. This property has only an effect, when the when the TextControl.EditMode is set to ReadAndSelect and the DocumentPermissions.AllowEditingFormFields property has been set to true. In this case a Formfield can only be edited, when its Enabled property is true. When a FormField is disabled, the TextFieldClicked and TextFieldDoubleClicked of the Formfield are suppressed. The default value of this property is true. (Inherited from FormField.) |
| IsDateControlVisible | Gets or sets a value indicating wheather a date control is shown below the DateFormField so that the user can select a date. |
| SupportedDateFormats | Gets an array of format picture strings which can be used to format the date. The returned format strings depend on the culture set for the date field's text. A TextControl uses Day, Month, Year, and Era Format Picture strings to format a date. |
Methods
| Method | Description |
|---|---|
| FormFieldDialog | Opens a dialog box to alter the formatting attributes of the form field. (Inherited from FormField.) |