Hi, I need suport to pass my telerik report to MVVM pattern
right now my report is send to the printer, and all the programming is in xaml and their code behind:
in the user control xaml:
<tr:ReportViewer Name="ReportViewer1" Width="0" Height="0" Grid.Column="0" Grid.Row="2">
<tr:ReportViewer.ReportSource>
<telerikReporting:TypeReportSource TypeName="ReportLibrary, ReportLibrary" />
</tr:ReportViewer.ReportSource>
</tr:ReportViewer>
and in the user control code behind:
public ucInventarioPTaVentas()
{
InitializeComponent();
_InventarioVendido = new ObservableCollection<InventarioPTaVentasCL>();
var TRS = new TypeReportSource();
TRS.TypeName = typeof(rpMaterialVendido).AssemblyQualifiedName;
ReportViewer1.ReportSource = TRS;
}
private void btnImprimir_Click(object sender, RoutedEventArgs e)
{
foreach (var item in grdColeccion.Items)
{
if (((InventarioPTaVentasCL)item).seleccionada)
{
_InventarioVendido.Add((InventarioPTaVentasCL)item);
}
}
#region ImprimeReporteDeVentas
Report rpt;
rpt = new rpMaterialVendido();
rpt.DataSource = _InventarioVendido;
Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
instanceReportSource.ReportDocument = rpt;
instanceReportSource.Parameters.Add("pCliente", cbClienteNombre.Text);
ReportViewer1.ReportSource = instanceReportSource;
ReportViewer1.PrintReport();
#endregion
}
But, for all my app, I using the MVVM pattern, obviously on my ViewModel I have the observablecollection and the parametrs needed to my report, and I don't know how make the report with the MVVM pattern, can you help me??