New to Telerik UI for WPF? Download free 30-day trial

Custom Date Ranges

The custom ranges are a set of pre-defined date spans displayed next to the calendars of the DateRangePicker component. The set can be used to easily select a specific time span.

The RadDateRangePicker control has the following built-in ranges, that can be customized or removed with the CustomRangesLoadingEventArgs event.

  • Last 7 Days
  • Last 30 Days
  • Last Month
  • Last Year

Picture showing the pre-defined custom date ranges of WPF RadDateRangePicker

Adding and removing ranges in the CustomRangesLoadingEventArgs event handler

private void RadDateRangePicker_CustomRangesLoading(object sender, CustomRangesLoadingEventArgs e) 
{ 
    // removes the first predefined range 
    e.CustomRanges.RemoveAt(0); 
 
    // adds a new custom range 
    var newRange = new CustomRange("Last 42 days") 
    { 
        StartDate = DateTime.Today.AddDays(-42), 
        EndDate = DateTime.Today 
    }; 
    e.CustomRanges.Add(newRange); 
} 
Picture showing a new custom date range added to WPF RadDateRangePicker

Hiding the Date Ranges Panel

To hide the date ranges from the UI, set the IsDefaultRangesPanelVisible property of RadDateRangePicker to false.

Hiding the date ranges panel

<telerik:RadDateRangePicker IsDefaultRangesPanelVisible="False" /> 
Picture showing WPF RadDateRangePicker without the data ranges panel

See Also

In this article