Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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