Skip to main content
All docs
V24.2

ParameterPanelFluentBuilder Class

Contains methods that allow you to customize the Parameters panel.

Namespace: DevExpress.XtraReports.Parameters

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public class ParameterPanelFluentBuilder :
    ParameterPanelFluentBuilderBase

Remarks

You can unite report parameters into expandable groups, place parameters side-by-side, add separators, and more.

Default panel Customized panel
Default panel Customized panel

Use the ParameterPanelFluentBuilder class as follows:

  1. Call the static Begin method and pass a report instance as a parameter.
  2. Call methods that customize the panel.
  3. Call the End method.
using DevExpress.XtraReports.Parameters;
// ...
ParameterPanelFluentBuilder.Begin(report)
// Customize the panel
.End();

Pass the report instance to the Document Viewer after you finish customization of the Parameters panel for this instance. See the following examples for details on how to complete this task for the WinForms and ASP.NET Core platforms:

View Example: Reporting for WinForms - Customize the Parameters Panel

View Example: Reporting for ASP.NET Core - Customize the Parameters Panel

Customize the “Parameters” Panel

A customized Parameters panel contains items of the following types:

Parameter item
Customizes a report parameter.
Group item
Creates and customizes a parameter group.
Separator item
Adds a separator between groups and parameters.

There are two ways to create a new item:

  1. Call an item’s Begin method, customize the item, and call the item’s End method.

    ParameterPanelFluentBuilder.Begin(report)
        .BeginGroupItem()
            .WithTitle("Select a customer")
            .BeginParameterItem(report.Parameters[0])
                .WithLabelOrientation(Orientation.Vertical)
            .EndParameterItem()
        .EndGroupItem()
    .End();
    
  2. Call an item’s AddItem method and pass a customization action as a parameter.

    ParameterPanelFluentBuilder.Begin(report)
        .AddGroupItem(g => g
            .WithTitle("Select a customer")
            .AddParameterItem(report.Parameters[0], p0 => p0
                .WithLabelOrientation(Orientation.Vertical)))
    .End();
    

These ways have the same customization capabilities and differ only in syntax. In the following sections, we describe the second way in detail. For more examples on how to use the first way, refer to the description of the Begin/End methods:

Customize a Parameter

  1. Call the AddParameterItem method. This method accepts a report parameter or its name.
  2. Optional. Implement a customization action and pass this action to the AddParameterItem method as a second argument. The example below uses the WithLabelOrientation method to position the text label above the parameter editor.
using DevExpress.XtraReports.Parameters;
// ...
using Orientation = DevExpress.XtraReports.Parameters.Orientation;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .AddParameterItem(report.Parameters[0], p => p
        .WithLabelOrientation(Orientation.Vertical))
.End();
orientation = Horizontal (Default) orientation = Vertical
orientation = Horizontal (Default) orientation = Vertical

Call the AddParameterItem method only for those report parameters that you want to customize. The Parameters panel displays the remaining parameters at the end (with default settings).

Create and Customize a Group

Call the AddGroupItem method and implement a customization action. In this action, customize group appearance, add parameters, groups, and separators.

using DevExpress.XtraReports.Parameters;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .AddParameterItem(report.Parameters[0])
    .AddGroupItem(g => g
        .WithTitle("Select a customer")
        .AddParameterItem(report.Parameters[1])
        .AddParameterItem(report.Parameters[2]))
.End();
Default panel Panel with a group
Default panel Panel with a group

The example above uses the WithTitle method to specify a group title. You can also use the following methods to configure a group:

Add a Separator

Call the AddSeparatorItem method to add a separator between parameters or groups.

using DevExpress.XtraReports.Parameters;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .AddParameterItem(report.Parameters[0])
    .AddSeparatorItem()
    .AddParameterItem(report.Parameters[1])
.End();
Default panel Panel with a separator between parameters
Default panel Customized panel

Modify a Customized Panel

You can reconfigure items of a customized panel or remove some or all items to discard customization.

The following example removes a parameter and separator from a group and changes the label orientation of another parameter from the same group.

using DevExpress.XtraReports.Parameters;
// ...
using Orientation = DevExpress.XtraReports.Parameters.Orientation;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .GetGroupItem(0)
        .RemoveParameterItem(report.Parameters[0])
        .RemoveSeparatorItem(0)
        .GetParameterItem(report.Parameters[1], p1 => p1
            .WithLabelOrientation(Orientation.Horizontal))
.End();
Initial panel Modified panel
Default panel Customized panel

Refer to the descriptions of the following methods for more information:

Examples

Place Parameters Side-by-Side and Unite Them into Groups

using DevExpress.XtraReports.Parameters;
// ...
using Orientation = DevExpress.XtraReports.Parameters.Orientation;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .AddGroupItem(g0 => g0
        .WithTitle("Select dates")
        .AddParameterItem(report.Parameters[0], p0 => p0
            .WithLabelOrientation(Orientation.Vertical)))
    .AddGroupItem(g1 => g1
        .WithTitle("Select a customer")
        .WithOrientation(Orientation.Horizontal)
        .WithShowExpandButton(true)
        .AddParameterItem(report.Parameters[1], p1 => p1
            .WithLabelOrientation(Orientation.Vertical))
        .AddSeparatorItem()
        .AddParameterItem(report.Parameters[2], p2 => p2
            .WithLabelOrientation(Orientation.Vertical)))
.End();
Default panel Customized panel
Default panel Customized panel

Enable/Disable a Parameter Editor Based on a Value of Another Parameter

The following example specifies an expression for a parameter’s Enabled property to enable/disable the parameter’s editor based on a value of another parameter.

using DevExpress.XtraReports.Parameters;
// ...
using DevExpress.XtraReports.Expressions;
// ...
ParameterPanelFluentBuilder.Begin(report)
    .AddGroupItem(g0 => g0
        .WithTitle("Select dates")
        .AddParameterItem(report.Parameters[0]))
    .AddGroupItem(g1 => g1
        .WithTitle("Select a customer")
        .AddParameterItem(report.Parameters[1])
        .AddParameterItem(report.Parameters[2]))
.End();

report.Parameters["customer"].ExpressionBindings.Add(
    new BasicExpressionBinding() {
        PropertyName = "Enabled",
        Expression = "!IsNullOrEmpty(?company)",
});

Enable/Disable a parameter editor based on a value of another parameter

You can specify the same expression for the parameter’s Visible property to show/hide the parameter’s editor.

Show/Hide a parameter editor based on a value of another parameter

Inheritance

See Also