The DatePicker control allows the user to select a date by typing the date in the textbox or using the drop-down calendar control.
1 2
[TemplatePart(Name = ElementTextBox, Type = typeof(DatePickerTextBox))] publicclassDatePicker : System.Windows.Controls.DatePicker, IDataInput
Create DatePicker
1
<hc:DatePicker />
1
var datePicker = new DatePicker();
The generated DatePicker is shown below:
Select date
You can enter the date through the textbox, or click the button to the right of the text box to open the drop-down calendar control to select the date.
You can also set the date like this in a XAML clock or code.
You can add Headers and Placeholders to the DatePicker to indicate to the user what they do.
1 2 3 4
<hc:DatePickerhc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Placeholder="Please enter the content" hc:InfoElement.Title="Title" />