The requested page is not available for the requested platform. You are viewing the content for Default platform.

XRControl.Parent Property

Specifies the parent object that contains the current control.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v19.1.dll

Declaration

[Browsable(false)]
public virtual XRControl Parent { get; set; }
<Browsable(False)>
Public Overridable Property Parent As XRControl

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;
    }
}
See Also