public static void SetupDesignTimeSubreportDatasourcePassing(this IDesignerContext designContext)
        {
            // Selected Subreport on Design Panel
            SubreportBase selectedSubreport = null;

            var controller = designContext.DesignForm.DesignMdiController;

            // Design-Time Event Handler
            controller.OnDesignPanelActivated(designPanel =>
            {
                var report = designPanel.Report;

                // TODO: Set DesignPanel Filename?
                // string url;
                // report.Extensions.TryGetValue("StorageID", out url);
                // designPanel.FileName = url;

                // Populate Design-Time Datasource
                report.TryAs <MyReportBase>(myReport =>
                {
                    if (selectedSubreport == null)
                    {
                        // Stand-alone Report
                        myReport.ChangeDesignTimeDatasourceToDefault(designContext);
                    }
                    else
                    {
                        // Subreport was Double-clicked, new DesignPanel has been activated for it
                        // Pass Design-Time DataSource from Parent to Subreport
                        PassDesignTimeDataSourceToSubreport(selectedSubreport, myReport, designContext);
                    }
                });

                // Capture selected Subreport
                // So we can enable double-clicking Subreport
                designPanel.SelectionChanged += (sender, e) =>
                {
                    var selected      = designPanel.GetSelectedComponents();
                    selectedSubreport = selected.OfType <SubreportBase>().SingleOrDefault();

#if DEBUG
                    if (selectedSubreport != null)
                    {
                        var path = selectedSubreport.Band.GetFullDataMemberPath();
                        Debug.WriteLine("You selected subreport with Path: {0}".FormatString(path));
                    }
#endif
                };
            });
        }
        public static void PassDesignTimeDataSourceToSubreport(SubreportBase container, MyReportBase subreport, IDesignerContext designContext)
        {
            var parentReport = (MyReportBase)container.RootReport;

            var parentDataSourceItem = parentReport.GetSelectedDesignTimeDatasource();

            if (parentDataSourceItem != null)
            {
                var path = GetFullDataMemberPath(container.Band);

                var datasourceDefinition = new DesignTimeDataSourceDefinition(parentDataSourceItem.DataSourceUniqueId, parentDataSourceItem.DataSourceName, path);

                // Go!
                subreport.ChangeDesignTimeDatasource(datasourceDefinition, designContext);
            }
        }
 public ReportActivatedBySubreportMessage(XtraReport myReport, SubreportBase selectedSubreport)
 {
     NewReport = myReport;
     SelectedSubreport = selectedSubreport;
 }
        public static void PassDesignTimeDataSourceToSubreport(SubreportBase container, MyReportBase subreport, IDesignerContext designContext)
        {
            var parentReport = (MyReportBase)container.RootReport;

            var parentDataSourceItem = parentReport.GetSelectedDesignTimeDatasource();

            if (parentDataSourceItem != null)
            {
                var path = DesignTimeHelper.GetFullDataMemberPath(container.Band);

                var datasourceDefinition = new DesignTimeDataSourceDefinition(parentDataSourceItem.DataSourceName, parentDataSourceItem.DataSourceAssemblyLocationPath, path);

                // Go!
                subreport.ChangeDesignTimeDatasource(datasourceDefinition, designContext);
            }
        }