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.v24.1.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 code sample below uses a RangeParametersSettings class instance to create a date range parameter, set the range value to the last 7 days, and filter report data by this range. The code also clears the list of predefined date ranges and adds the September and October predefined ranges to the parameter’s editor.
using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.Expressions;
// ...
// 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));