Back to Devexpress

Implement a Custom Parameter Editor in WinForms Applications

xtrareports-5110-desktop-reporting-winforms-reporting-winforms-reporting-print-preview-api-and-customization-implement-custom-parameter-editor.md

latest4.8 KB
Original Source

Implement a Custom Parameter Editor in WinForms Applications

  • Nov 10, 2025
  • 2 minutes to read

You can use BaseEdit descendants as custom parameter editors in the Parameters panel.

Important

Customization options described in this help topic are available to owners of DevExpress WinForms, DXperience, and Universal subscriptions (subscriptions that include DevExpress WinForms UI Controls). The DevExpress Reporting Subscription does not support UI customization in Report Viewer or End-User Report Designer. You can use ReportPrintTool and ReportDesignTool classes to display Print Preview and End-User Report Designer in their default configurations.

Refer to the following help topic for information on subscription options: Installation - Subscriptions that Include Reporting Components.

To use a custom editor, do the following:

To resize a custom parameter editor, use the editor’s MinimumSize and MaximumSize properties.

Example

The following code snippet replaces the parameter editor with a radio group.

View Example: Implement a Custom Parameter Editor (WinForms)

csharp
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraReports.Parameters;
// ...
private void XtraReport1_ParametersRequestBeforeShow(object sender, ParametersRequestEventArgs e) {
    // Create and set up a radio group editor.
    var radioGroup = CreateRadioGroup();

    // Find a required parameter by name and assign
    // a custom editor to the Editor property.
    foreach (var info in e.ParametersInformation) {
        if (info.Parameter.Name == "shape") {
            info.Editor = radioGroup;
            break;
        }
    }
}

private RadioGroup CreateRadioGroup() {
    var radioGroup = new RadioGroup();

    string[] radioGroupItemTitles = new string[] {
        "Circle", "Rectangle", "Ellipse",
        "Triangle", "Square"
    };

    foreach (var item in radioGroupItemTitles) {
        radioGroup.Properties.Items.Add(new RadioGroupItem(item, item));
    }

    radioGroup.Properties.ItemVertAlignment = RadioItemVertAlignment.Top;
    radioGroup.MinimumSize = new System.Drawing.Size(0, 100);

    return radioGroup;
}
vb
Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls
Imports DevExpress.XtraReports.Parameters
' ...
Private Sub XtraReport1_ParametersRequestBeforeShow(ByVal sender As Object, ByVal e As ParametersRequestEventArgs) Handles MyBase.ParametersRequestBeforeShow
    ' Create and set up a radio group editor.
    Dim radioGroup = CreateRadioGroup()

    ' Find a required parameter by name and assign
    ' a custom editor to the Editor property.
    For Each info In e.ParametersInformation
        If info.Parameter.Name = "shape" Then
            info.Editor = radioGroup
            Exit For
        End If
    Next info
End Sub

Private Function CreateRadioGroup() As RadioGroup
    Dim radioGroup = New RadioGroup()

    Dim radioGroupItemTitles() As String = {"Circle", "Rectangle", "Ellipse", "Triangle", "Square"}

    For Each item In radioGroupItemTitles
        radioGroup.Properties.Items.Add(New RadioGroupItem(item, item))
    Next item

    radioGroup.Properties.ItemVertAlignment = RadioItemVertAlignment.Top
    radioGroup.MinimumSize = New System.Drawing.Size(0, 100)

    Return radioGroup
End Function

See Also

Report Parameters of Custom Types

Create a Report Parameter