StaticListLookUpSettings Class
Provides access to a report parameter‘s list of static values.
Namespace: DevExpress.XtraReports.Parameters
Assembly: DevExpress.Printing.v24.2.Core.dll
NuGet Package: DevExpress.Printing.Core
#Declaration
public class StaticListLookUpSettings :
LookUpSettings,
IXtraSupportDeserializeCollectionItem
#Remarks
Assign an instance of the StaticListLookUpSettings class to a parameter’s ValueSourceSettings property to provide a static list of predefined values for this parameter. You can also set the parameter’s ValueSourceSettings property to:
- a DynamicListLookUpSettings class instance - to specify the storage used to retrieve the list of predefined parameter values.
- a RangeParametersSettings class instance - to specify the nested start and end parameters for a report’s date range parameter.
Use the LookUpValues property to specify the list of static values.
Ensure that the listed values match the parameter’s Type - otherwise the editor’s validation rejects the value.
Users can select a value from the specified list only. However, you can specify an unlisted value for the parameter in code.
See Parameters Overview for more information.
#Example
The code sample below illustrates how to create a date parameter with a static list of predefined values and filter report data by this parameter.
using DevExpress.XtraReports.Parameters;
using DevExpress.XtraReports.UI;
using System;
using System.Collections.Generic;
// ...
void CreateDateParameter()
{
XtraReport report = new XtraReport();
Parameter myDateParameter = new Parameter();
myDateParameter.Name = "myDateParameter";
// Sets the Visible property to true to request the parameter value from users.
// Sets this property to false to apply the parameter's value that is specified in code.
myDateParameter.Visible = true;
myDateParameter.Type = typeof(System.DateTime);
// Specifies the parameter's static list of predefined values
StaticListLookUpSettings lookupSettings = new StaticListLookUpSettings();
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 01, 01), "January 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 02, 01), "February 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 03, 01), "March 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 04, 01), "April 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 05, 01), "May 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 06, 01), "June 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 07, 01), "July 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 08, 01), "August 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 09, 01), "September 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 10, 01), "October 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 11, 01), "November 1, 2019"));
lookupSettings.LookUpValues.Add(new LookUpValue(new DateTime(2019, 12, 01), "December 1, 2019"));
myDateParameter.ValueSourceSettings = lookupSettings;
report.Parameters.Add(myDateParameter);
// Filters report data by the specified parameter.
report.FilterString = "GetDate([OrderDate]) >= ?myDateParameter";
}