Skip to main content
A newer version of this page is available. .

StaticListLookUpSettings Class

Provides access to a report parameter‘s list of static values.

Namespace: DevExpress.XtraReports.Parameters

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

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:

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.Expressions;
// ...
XtraReport1 report = new XtraReport1();

Parameter myDateParameter = new Parameter();
myDateParameter.Name = "myDateParameter";
// Set the Visible property to true to request the parameter value from users.
// Set this property to false to apply the parameter's value that is specified in code.
myDateParameter.Visible = true;
myDateParameter.Type = typeof(System.DateTime);
// Specify 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);
// Filter report data by the specified parameter.
report.FilterString = "GetDate([OrderDate]) >= ?myDateParameter";

Inheritance

See Also