XtraReport.MasterReport Property

Gets or sets the XtraReport object which contains the current report as a subreport.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v18.1.dll

Declaration

public XtraReport MasterReport { get; set; }
Public Property MasterReport As XtraReport

Property Value

Type Description
XtraReport

The XtraReport object which includes the current report.

Use this property to access the master report from the subreport. If there isn't any master report assigned then this property returns null (Nothing in Visual Basic).

Examples

This example demonstrates how to use the MasterReport property in a report which is the SubreportBase.ReportSource for a subreport contained in the master report.

For this example to work properly, a master report should be set up as in the image below, where the XRLabel object in the Report Footer band is named 'MasterReportLabel'.

Then, the following code should be added to handle the XRControl.BeforePrint event of the XRLabel control, located in the subreport.

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

private void SubReportLabel_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) {
   // Change the background color of the label located on
   // the page footer band of the master report.
   MasterReport.Bands["ReportFooter"].Controls["MasterReportLabel"].BackColor = Color.Aqua;
}