Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

XRControl.Parent Property

Specifies the parent object that contains the current control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.2.dll

NuGet Package: DevExpress.Reporting.Core

#Declaration

[Browsable(false)]
public virtual XRControl Parent { get; set; }

#Property Value

Type Description
XRControl

The current control’s parent.

#Remarks

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