A newer version of this page is available. Switch to the current version.

XRControl.Controls Property

Gets the collection of XRControl objects or their descendants that are contained in this control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.2.dll


public XRControlCollection Controls { get; }
Public ReadOnly Property Controls As XRControlCollection

Property Value

Type Description

An object of the XRControlCollection class representing the collection of contained controls.


An XRControl object acts as a parent for any control contained within its collection. This collection is returned by its Controls property. Objects in this collection are considered to be child controls of the XRControl object. If a control can have child controls then its XRControl.CanHaveChildren property is equal to true.


The following method aligns controls contained in an XRControl object. The controls are aligned with the topmost control. Access to the controls is provided via the XRControl.Controls property.

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

public void AlignHorizontally(XRControl container) {

    // Make sure that the collection is not empty.
    if(container.Controls.Count > 0) {

        // Assign the Y-coordinate of the first control in the collection to a variable.
        int y = container.Controls[0].Top;

        // Find the Y-coordinate of the topmost control.
        foreach(XRControl control in container.Controls) 
            if(control.Top < y)
                y = control.Top;

        // Align the controls with the topmost control.
        foreach(XRControl control in container.Controls) 
            control.Location = new Point(control.Left, y);
See Also