How to: Access the Report Designer Control (Blazor)
This example demonstrates how to access the adapter of the DxReportDesigner component that Blazor XAF applications use to display reports.
When a user customize a report at runtime, a Blazor application opens a Detail View that contains ReportDesignerViewItem. Follow the steps below to access this View Item and its component:
- Add the DevExpress.ExpressApp.ReportsV2.Blazor NuGet package to the Blazor Module project (MySolution.Module.Blazor).
- In the Blazor Module project (MySolution.Module.Blazor), create a View Controller.
- Set its View property to DetailView and TargetViewId to the View’s identifier. The ReportsBlazorModuleV2.ReportDesignerDetailViewName constant stores this identifier.
- In the overridden OnActivated method, call the CustomizeViewItemControl<T>(DetailView, Controller, Action<T>) method.
- Use the ViewItem.Control property to access the Report Viewer’s control.
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.ReportsV2.Blazor;
// ...
public class AccessReportDesginerController : ViewController<DetailView> {
public AccessReportDesginerController() {
TargetViewId = ReportsBlazorModuleV2.ReportDesignerDetailViewName;
}
protected override void OnActivated() {
base.OnActivated();
View.CustomizeViewItemControl<ReportDesignerViewItem>(this, CustomizeDesignerViewItem);
}
private void CustomizeDesignerViewItem(ReportDesignerViewItem designerDetailItem) {
string reportName = ((ReportDesignerViewItem.DxReportDesignerAdapter)designerDetailItem.Control).ComponentModel.ReportName;
// ...
}
}