Skip to main content

XRControl.Parent Property

Specifies the parent object that contains the current control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core


public virtual XRControl Parent { get; set; }

Property Value

Type Description

The current control’s parent.


This property returns a report, band or report control that contains the current control. You can then customize settings of the parent and its child controls. To check whether the parent contains child controls, use the XRControl.CanHaveChildren property. Use the XRControl.Controls property to get the collection of child controls.

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

void OnTableCellBeforePrint(object sender, System.ComponentModel.EventArgs e) {
    var tableCell = sender as XRTableCell;

    // Get the parent control for the table cell.
    var row = tableCell.Parent;

    // Get the parent control for the table row.
    var table = row.Parent;

    // Specify the foreground color for even table rows.
    if((table.Controls.IndexOf(row) % 2) == 0) {
        tableCell.ForeColor = Color.Red;
See Also