Back to Devexpress

RangeParameterEditorOptions.PredefinedDateRanges Property

corelibraries-devexpress-dot-xtrareports-dot-parameters-dot-rangeparametereditoroptions-b49ee856.md

latest4.6 KB
Original Source

RangeParameterEditorOptions.PredefinedDateRanges Property

Stores the list of predefined date ranges available in the date range parameter editor in Print Preview.

Namespace : DevExpress.XtraReports.Parameters

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

NuGet Package : DevExpress.Printing.Core

Declaration

csharp
public static Dictionary<string, Func<Range<DateTime>>> PredefinedDateRanges { get; }
vb
Public Shared ReadOnly Property PredefinedDateRanges As Dictionary(Of String, Func(Of Range(Of Date)))

Property Value

TypeDescription
Dictionary<String, Func<Range<DateTime>>>

The dictionary of predefined ranges that are available in date range parameter editors.

|

Remarks

The list of predefined date ranges stored in the PredefinedDateRanges property is displayed in the date range parameter editor in Print Preview.

When you make changes to the predefined date ranges, the changes become available in the date range parameter editor.

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:

Note

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

csharp
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));
vb
Imports DevExpress.XtraReports.Parameters
' ...
' Remove all predefined ranges and add two new date ranges.
RangeParameterEditorOptions.PredefinedDateRanges.Clear()
RangeParameterEditorOptions.RegisterDateRange("September", Function() New Date(2019,9,1), Function() New Date(2019,9,30))
RangeParameterEditorOptions.RegisterDateRange("October", Function() New Date(2019,10,1), Function() New Date(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

Range Report Parameters

RangeParameterEditorOptions Class

RangeParameterEditorOptions Members

DevExpress.XtraReports.Parameters Namespace