Skip to main content
A newer version of this page is available. .

XRControl.Parent Property

Specifies the parent object that contains the current control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.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.Drawing.Printing.PrintEventArgs 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;
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Parent property.

Note

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