Back to Devexpress

XRControlCollection Class

xtrareports-devexpress-dot-xtrareports-dot-ui-8d431575.md

latest4.8 KB
Original Source

XRControlCollection Class

A collection of XRControl objects.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public class XRControlCollection :
    XRControlCollectionBase
vb
Public Class XRControlCollection
    Inherits XRControlCollectionBase

The following members return XRControlCollection objects:

Remarks

The XRControlCollection.Add and XRControlCollection.Remove methods enable you to add and remove individual controls from the collection. You can determine if the control is a member of the collection by passing the control into the XRControlCollection.Contains method. To get the index value of the control in the collection, pass this control into the XRControlCollection.IndexOf method.

Example

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.

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

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

    // 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.
    if(panel.Controls.Contains(item))

        // Remove the control from the collection.
        panel.Controls.Remove(item);
}
vb
Imports System.Drawing
Imports DevExpress.XtraReports.UI
' ...

Public Sub AddControl(ByRef panel As XRPanel, ByRef item As XRControl, _
ByVal x As Integer, ByVal y As Integer)
    ' Add a control to the collection.
    panel.Controls.Add(item)

    ' Set the control's location within the panel.
    item.Location = New Point(x, y)
End Sub

Public Sub RemoveControl(ByRef panel As XRPanel, ByRef item As XRControl)
    ' Check if the control belongs to the collection.
    If (panel.Controls.Contains(item)) Then

         ' Remove the control from the collection.
         panel.Controls.Remove(item)
    End If
End Sub

Inheritance

Object CollectionBase XRControlCollectionBase XRControlCollection BandCollection

XRCrossTabCellCollection

XRTableCellCollection

XRTableRowCollection

DetailReportBandCollection

See Also

XRControlCollection Members

DevExpress.XtraReports.UI Namespace