Skip to main content

XRControlCollection.Add(XRControl) Method

Adds the specified control to the collection.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.Reporting.Core


public int Add(
    XRControl child


Name Type Description
child XRControl

An XRControl object to add to the collection.


Type Description

An integer value indicating the position into which the new element was inserted. If the control is already included in the collection the return value indicates the existing position of the control inside the collection.


This method adds the control to the end of the collection.


The following example shows two methods that use the XRControlCollection.Add, XRControlCollection.Remove and XRControlCollection.Contains methods of the XRControlCollection class. The first method adds a control to the control collection of the XRPanel object at the specified location. The second method checks if the specified control belongs to the specified collection, and if it does, it removes the control from the collection.

using System.Drawing;
using DevExpress.XtraReports.UI;
// ...

public void AddControl(XRPanel panel, XRControl item, int x, int y) {
    // Add a control to the collection.

    // Set the control's location within the panel.
    item.Location = new Point(x, y);

public void RemoveControl(XRPanel panel, XRControl item) {
    // Check if the control belongs to the collection.

        // Remove the control from the collection.

The following code snippets (auto-collected from DevExpress Examples) contain references to the Add(XRControl) method.


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.

See Also