Parameter Class
A report parameter.
Namespace: DevExpress.XtraReports.Parameters
Assembly: DevExpress.Printing.v24.1.Core.dll
NuGet Package: DevExpress.Printing.Core
Declaration
[TypeConverter("DevExpress.XtraReports.Design.ParameterValueEditorChangingConverter,DevExpress.Utils.v24.1.UI, Version=24.1.99.0, Culture=neutral, PublicKeyToken=c38a27d2243c2672")]
public class Parameter :
Component,
IXtraSupportShouldSerialize,
IXtraSupportDeserializeCollectionItem,
IReportMultiValueParameter,
IMultiValueParameter,
IParameter,
IFilterParameter,
INullableParameter,
IRangeRootParameter
Remarks
Report parameters allow you and your end users to filter report data dynamically.
Refer to the following topic for more information: Use Report Parameters.
Example
To create a parameter in code, initialize a Parameter class instance and specify its properties. Add the parameter to the report’s Parameters collection.
The code sample below demonstrates how to create a date parameter, specify an expression for the parameter’s default value, and reference the parameter in a label‘s expression.
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
using DevExpress.XtraReports.Parameters;
// ...
using DevExpress.XtraReports.Expressions;
// ...
// Create a date report parameter.
// Use an expression to specify the parameter's default value.
var dateParameter = new Parameter() {
Name = "date",
Description = "Date:",
Type = typeof(System.DateTime),
ExpressionBindings = { new BasicExpressionBinding("Value", "Now()") }
};
// Create a label and bind the label's Text property to the parameter value.
// Use the parameter's name to reference the parameter in the label's expression.
var dateLabel = new XRLabel() {
ExpressionBindings = { new ExpressionBinding("Text", "?date") },
BoundsF = new RectangleF(0, 0, 200, 50),
};
// Create a report and add the label to the report's Detail band.
var report = new XtraReport() {
Bands = { new DetailBand() { Controls = { dateLabel } } },
};
// Add the parameter to the report's Parameters collection.
report.Parameters.Add(dateParameter);
Inheritance
See Also