Date picker widget: Define the date picker control
To define the date picker control, perform the following:
- In the context menu of the project, click Add » New Item...
- In the left pane, select Visual C# Items » Code.
- Click Class and in the Name input field, enter DatePickerField.
- Change the class definition to inherit from
FieldControl
and IFormFieldControl
classes.
- Add a constructor that adds a default value to the title to
Untitled.
- Add a JavaScript serializer to the class.
- Provide properties for common date picker fields.
- Provide a property for accessing the value in the date picker that is currently selected.:
- Save the file.
GITHUB EXAMPLE: For more information about the content of the file, see the DatePickerField.cs file of the downloaded sample project.
You create properties for the minimum and the maximum dates that user can select, the value that is currently selected and the meta information. When defining the Value
property you refer the DatePicker field from the template. For more information, see Date picker widget: Reference the template in the control.
Next, you must define the visuals of the date picker control.