Skip to main content

RangeParameterEditorOptions.RegisterDateRange(String, Func<DateTime>, Func<DateTime>) Method

Appends an item to the list of predefined date ranges.

Namespace: DevExpress.XtraReports.Parameters

Assembly: DevExpress.Printing.v25.2.Core.dll

NuGet Package: DevExpress.Printing.Core

Declaration

public static void RegisterDateRange(
    string name,
    Func<DateTime> getStart,
    Func<DateTime> getEnd
)

Parameters

Name Type Description
name String

The predefined date range’s name.

getStart Func<DateTime>

The function that returns the predefined date range’s start date.

getEnd Func<DateTime>

The function that returns the predefined date range’s end date.

Remarks

Use this method to append an item to the list of predefined date ranges stored in the PredefinedDateRanges property. The appended predefined date range becomes available in the date range parameter editor in Print Preview.

Example

The following example modifies the available date ranges displayed in Print Preview. The code clears the list of predefined date ranges and adds the September and October predefined ranges to the parameter’s editor for a date range parameter:

A user specifies a start date and an end date. The custom **September** and **October** date ranges are available.

Note

This code is in effect for WinForms and WPF End-User Reporting Applications only.

using DevExpress.XtraReports.Parameters;
// ...
// Remove all predefined ranges and add two new date ranges.
RangeParameterEditorOptions.PredefinedDateRanges.Clear();
RangeParameterEditorOptions.RegisterDateRange("September", () => new DateTime(2019,9,1), () => new DateTime(2019,9,30));
RangeParameterEditorOptions.RegisterDateRange("October", () => new DateTime(2019,10,1), () => new DateTime(2019,10,31));

Refer to the following example that creates a date range parameter in code and uses this parameter to filter the report’s data:

View Example: Create a Date-Range Report Parameter

See Also