Creating WPF Application to Implement SSRS Reports - Not Model - View - ViewModel...
Create
a WPF Application from the Solution
Regards,
Add
the DLL called Microsoft.ReportViewer.WinForms
from the reference.
Add
a button control and Report Viewer Control to the XAML Page or to the Design.
The XAML should look like the below code
<Window xmlns:av="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
x: Class="ReportPresentation.MainWindow"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Xmlns:rv="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Content="Display
Report" Height="600px" HorizontalAlignment="Left" Margin="17, 17,0,0" Name="btnDisplayReport" VerticalAlignment="Top" Width="103" />
<av:WindowsFormsHost Height="215" HorizontalAlignment="Left" Margin="25,67,0,0" Name="winFormHost" VerticalAlignment="Top" Width="1300px">
<rv:ReportViewer x:Name="repViewer"/>
</av:WindowsFormsHost>
</Grid>
</Window>
Write the C#
Code in Button Click event to render the SSRS RDL from Report Server
Private
void btnDisplayReport_Click(object sender, RoutedEventArgs
e)
{
try
{
repViewer.ProcessingMode =
Microsoft.Reporting.WinForms.ProcessingMode.Remote;
repViewer.ServerReport.ReportServerUrl =
new Uri (http://Prodsql01/ReportServer);
repViewer.ServerReport.ReportPath = "/Hutch/Reports/DetailedReport";
repViewer.RefreshReport();
repViewer.Show();
}
catch (Exception Ex)
{
String K = Ex.Message;
}
}
Build
and run the application now.
Note: Again thanks to My Client who gave me such a task to improve my Skills in different technologies. I'm still learning and Eagar to learn more. Now its a serious note to move on next Cross Platform technologies with this confident...
Regards,
Daniel J,
Dataware House and Data Mining Architect...
No comments:
Post a Comment