Back to Devexpress

Date Range Picker

windowsforms-404685-ui-templates-data-editors-date-range-picker.md

latest1.1 KB
Original Source

Date Range Picker

  • Nov 29, 2023

The Date Range Picker (DateRangePicker) is a text box with a dropdown calendar that allows you to select a date range.

Date Range (Edit Value)

Use the editor’s EditValue property to get a date range selected by a user, or set it in code.

csharp
using DevExpress.XtraEditors.Controls;

//...
dateRangePicker1.EditValue = new DateRange(DateTime.Now, DateTime.Now.AddDays(7));

Use the editor’s StartDate and EndDate properties to obtain start and end dates of the range.

csharp
DateTime startDate = dateRangePicker1.StartDate;
DateTime endDate = dateRangePicker1.EndDate;

Setting the EditValue property to null automatically assigns the value of the DateRangePicker.NullValue property.

Note

Setting the NullValue property to null sets the value to new DateRange(DateTime.Today, DateTime.Today).