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

XtraReport.MasterReport Property

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

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.1.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

[Browsable(false)]
public XtraReport MasterReport { get; set; }

Property Value

Type Description
XtraReport

The XtraReport object which includes the current report.

Remarks

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).

Example

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