Hello,
first of all i guess you want to generate rdlc in WPF application? If so you should use WindowsFormHost element and there you should input the windows control like this:
<Grid>
<WindowsFormsHost Height="39" Name="Host" Width="200" />
</Grid>
than in windows form load event:
public Print()
{
InitializeComponent();
report = new Microsoft.Reporting.WinForms.ReportViewer();
Host.Child = report;
this.report.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(MySubreportEventHandler);
}
You can also add the report control direct in the xaml. You can use the Report Wizard to generate a report. The report can use DataSets or objects. Here is a little sample code where make from a class T a DataSet and view the report:
public void DayReport(DayReport rep)
{
Microsoft.Reporting.WinForms.ReportDataSource reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource();
reportDataSource.Name = "SRDayReport";
System.Windows.Forms.BindingSource bind = new System.Windows.Forms.BindingSource();
DataSet DayReport = new DataSet();
DayReport.Tables.Add("SRDayReport");
DayReport.Tables[0].Columns.Add("Date_Start", typeof(DateTime));
DayReport.Tables[0].Columns.Add("Date_End", typeof(DateTime));
DayReport.Tables[0].Columns.Add("TotalPriceDelivery", typeof(Double));
DayReport.Tables[0].Columns.Add("TotalPriceSell", typeof(Double));
DayReport.Tables[0].Columns.Add("Profit", typeof(Double));
DayReport.Tables[0].Columns.Add("TotalPriceDeliveryDev", typeof(Double));
DayReport.Tables[0].Columns.Add("TotalPriceSellDev", typeof(Double));
DayReport.Tables[0].Columns.Add("BalanceSellary", typeof(Double));
DayReport.Tables[0].Columns.Add("TotalServicePublished", typeof(Int32));
DayReport.Tables[0].Columns.Add("TotalServicePrice", typeof(Double));
DayReport.Tables[0].Columns.Add("TotalVisitsPublished", typeof(Int32));
DayReport.Tables[0].Columns.Add("TotalVisitsPrice", typeof(Double));
DayReport.Tables[0].Columns.Add("ProfitVisitAndServices", typeof(Double));
DayReport.Tables[0].Columns.Add("HumanTraffic", typeof(Int32));
DayReport.Tables[0].Columns.Add("BalanceDay", typeof(Double));
DataRow data;
data = DayReport.Tables[0].NewRow();
data["Date_Start"] = rep.DateBegin;
data["Date_End"] = rep.Date;
data["TotalPriceDelivery"] = rep.Invoice.TotalPriceDelivery;
data["TotalPriceSell"] = rep.Invoice.TotalPrice;
data["Profit"] = rep.Invoice.Profit;
data["TotalPriceDeliveryDev"] = rep.Delivery.TotalPriceDelivery;
data["TotalPriceSellDev"] = rep.Delivery.TotalPrice;
data["BalanceSellary"] = rep.BalanceSellary;
data["TotalServicePublished"] = rep.Service.ServiceCount;
data["TotalServicePrice"] = rep.TotalPriceServices;
data["TotalVisitsPublished"] = rep.Visits.VisitCount;
data["TotalVisitsPrice"] = rep.TotalPriceVisits;
data["ProfitVisitAndServices"] = rep.TotalPriceVisitsAndServices;
data["HumanTraffic"] = rep.Visits.VisitCount + rep.Service.ServiceCount;
data["BalanceDay"] = rep.BalanceDay;
DayReport.Tables[0].Rows.Add(data);
bind.DataSource = DayReport;
bind.DataMember = "SRDayReport";
reportDataSource.Value = bind;
report.LocalReport.DataSources.Add(reportDataSource);
report.LocalReport.ReportPath = @"Reports\Blanks\RpDay.rdlc";
report.RefreshReport();
}
Here is also a nice article from msdn
http://msdn.microsoft.com/en-us/library/ms251784(v=vs.80).aspx about making rdlc using a Business Object Data Source. Hope that helps.
Dimitar.