vijay rd

vijay rd

  • 1.5k
  • 103
  • 2.2k

Wpf reportviwer using xml as a l Datasource

Aug 12 2018 1:51 PM
I would like to know in this code what is missing. i can see the  datable in the(ds. table)  but i cannot see in the reportviwer in wpf . In windows application the bindingsource  automatically sets when select report rdlc in reportviwer. But in wpf  how.
 
  _reportViewer.Load += ReportViewer_Load;
        }
        private void window_Loaded(object sender, RoutedEventArgs e)
        {   
        }
        private bool _isReportViewerLoaded;
        private void ReportViewer_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            ds.ReadXml("Data.xml");
            ds.WriteXmlSchema("Data.xsd");
            if (!_isReportViewerLoaded)
            {
                Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new
                Microsoft.Reporting.WinForms.ReportDataSource();
                reportDataSource1.Name = "DataSet1";
                //Name of the report dataset in our .RDLC file
                reportDataSource1.Value = ds.Tables;
                ReportDataSource rds = new ReportDataSource("Name", ds.Tables[1]);
                this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
                this._reportViewer.LocalReport.ReportPath = "../../Report1.rdlc";
            }
        }
        private void WindowsFormsHost_ChildChanged(object sender, System.Windows.Forms.Integration.ChildChangedEventArgs e)
        {
        }
    }
}