Skip to main content

XtraReport.MasterReport Property

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

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v24.1.dll

NuGet Package: DevExpress.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.ComponentModel.EventArgs 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