Skip to main content

Parameter.Type Property

Specifies a parameter type.

Namespace: DevExpress.XtraReports.Parameters

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

NuGet Package: DevExpress.Printing.Core

Declaration

public virtual Type Type { get; set; }

Property Value

Type Default Description
Type String

A parameter type.

Remarks

The Type property specifies which values a parameter can accept. The following types are available:

  • String
  • DateTime
  • Number (16, 32, 64-bit integer, floating point, double-precision floating point, decimal)
  • Boolean
  • GUID (Globally Unique Identifier)

The following image illustrates editors for built-in parameter types:

parameters-ui-win

You can also assign custom types to the Type property. Refer to the following topic for more information: Report Parameters of Custom Types.

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.

Date parameter example

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);

The following code snippets (auto-collected from DevExpress Examples) contain references to the Type property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Implements

See Also