Back to Devexpress

XRDesignPanel Class

xtrareports-devexpress-dot-xtrareports-dot-userdesigner-2da95548.md

latest9.0 KB
Original Source

XRDesignPanel Class

A panel that is used to edit a report in the End-User Designer.

Namespace : DevExpress.XtraReports.UserDesigner

Assembly : DevExpress.XtraReports.v25.2.Extensions.dll

NuGet Package : DevExpress.Win.Reporting

Declaration

csharp
public class XRDesignPanel :
    PanelControl,
    IServiceProvider
vb
Public Class XRDesignPanel
    Inherits PanelControl
    Implements IServiceProvider

The following members return XRDesignPanel objects:

Show 19 links

Remarks

The XRDesignPanel class represents a single Design Panel, displaying a report’s bands and controls, allowing end-users to arrange and customize them.

A Design Panel can only display a single XtraReport instance. So, an XRDesignPanel instance is used to implement an SDI (single-document interface) End-User Designer, meaning that only a single XtraReport instance can be opened in the Designer at one time. And, in order to provide an MDI (multi-document interface) End-User Designer, the XRDesignMdiController component is used, which is capable of representing multiple XRDesignPanel instances.

A Design Panel can only be used as a part of an XRDesignForm (or, XRDesignRibbonForm).

Within a Design Panel, four tabs are available: Designer , Preview , HTML View and Scripts. The currently active tab index can be accessed via the XRDesignPanel.SelectedTabIndex property.

To load a report into the XRDesignPanel , call the XRDesignPanel.OpenReport method. And, the report currently opened in the XRDesignPanel can be accessed via its XRDesignPanel.Report property. To perform any actions on the report currently being edited in the XRDesignPanel , use the XRDesignPanel.ExecCommand method.

To learn more, refer to the following documents.

Example

Use the XRDesignPanel.Report property to access the report displayed in a Report Designer form. To save that report to a file, use the XRDesignPanel.SaveReport method.

csharp
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.UserDesigner;
// ...

private void button1_Click(object sender, System.EventArgs e) {
    // Create a new End-User Report Designer form.
    XRDesignForm designForm = new XRDesignForm();

    // Handle the DesignPanelLoaded event before opening a report in the Report Designer
    designForm.DesignMdiController.DesignPanelLoaded += DesignMdiController_DesignPanelLoaded;

    // Create a new blank report and show it the Report Designer dialog window.
    designForm.OpenReport(new XtraReport1());
    designForm.ShowDialog();
}

public XtraReport report;

void DesignMdiController_DesignPanelLoaded(object sender, DesignerLoadedEventArgs e) {
    // Access the currently opened report.
    report = (sender as XRDesignPanel).Report;

    // Save the report that is currently open to a file.
    (sender as XRDesignPanel).SaveReport(@"D:\\report.repx");
}
vb
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.UserDesigner
' ...

Private Sub button1_Click(sender As Object, e As System.EventArgs)
    ' Create a new End-User Report Designer form.
    Dim designForm As New XRDesignForm()

    ' Handle the DesignPanelLoaded event before opening a report in the Report Designer
    AddHandler designForm.DesignMdiController.DesignPanelLoaded, _ 
        AddressOf DesignMdiController_DesignPanelLoaded

    ' Create a new blank report and show it the Report Designer dialog window.
    designForm.OpenReport(New XtraReport1())
    designForm.ShowDialog()
End Sub

Public report As XtraReport

Private Sub DesignMdiController_DesignPanelLoaded(sender As Object, e As DesignerLoadedEventArgs)
    ' Access the currently opened report.
    report = TryCast(sender, XRDesignPanel).Report

    ' Save the report that is currently open to a file.
    TryCast(sender, XRDesignPanel).SaveReport("D:\\report.repx")
End Sub

Inheritance

Object MarshalByRefObject Component Control ScrollableControl XtraScrollableControl XtraPanel DevExpress.Utils.Controls.PanelBase PanelControl XRDesignPanel

See Also

XRDesignPanel Members

XRDesignBarManager

XRDesignDockManager

Reporting for WinForms

DevExpress.XtraReports.UserDesigner Namespace