Skip to main content

SubreportBase.ReportSource Property

Gets or sets an XtraReport class instance. The instance’s content is included in the main report.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v22.2.dll

NuGet Package: DevExpress.Reporting.Core


public XtraReport ReportSource { get; set; }

Property Value

Type Description

An XtraReport class instance.


Rebuild the solution at design time after you declare an XtraReport class to be able to reference this class in the XRSubreport‘s ReportSource property.


The ReportSource property is not available in Web Report Designer.

Use the ReportSourceUrl property instead of ReportSource to reference a report that is stored in a report definition (REPX) or XML file.

The ReportSourceUrl property value takes precedence over the ReportSource value. If you specify both properties, the XRSubreport includes the content from the report specified by ReportSourceUrl.

See XRSubreport for more information.


The code sample below adds an XRSubreport item to the report and uses the ReportSource property to reference a detail report.


Online Example: Use Subreports to Add a Chart

using System.IO;
using System.Drawing;
using DevExpress.XtraReports.UI;
// ...
XRSubreport subreport = new XRSubreport() {
    BoundsF = new RectangleF(0, 100, 550, 25),
// "mainReport" is an XtraReport instance.
// Add subreport to the main report's DetailBand.
// Reference an XtraReport instance named "detailReport" to include its content into the main report.
subreport.ReportSource = detailReport;

The code sample below handles the XRSubreport.BeforePrint event to add an XRLabel control to the referenced report’s instance.

using DevExpress.XtraReports.UI;
// ...
private void Subreport_BeforePrint(object sender, System.ComponentModel.CancelEventArgs e) {
    XRSubreport subreport = (XRSubreport)sender;
    XtraReport report = subreport.ReportSource;
    report.Bands["DetailBand"].Controls.Add(new XRLabel() {
        Text = " - ",
        BoundsF = new RectangleF(450, 0, 100, 25),
        Font = new Font(new FontFamily("Arial"), 9)
See Also