John Stagich's Blog

Microsoft .Net Developer

September 2009 Quick Hits

clock September 8, 2009 02:23 by author johnstagich
  • Frank La Vigne has a great link to learning SketchFlow in Microsoft Expresssion Blend.  The tutorial is comprised of videos, documentation, and code.

  • When working with Microsoft Blend 3.0/SketchFlow, the Assests->Styles->SketchStyles were missing.  Here is a link to the fix.  Go to Chuck Hays entry on July 22, 2009.  I had to add two entries into the registry.

  • From Joe Stagner's blog, Telerik has introducted two FREE Team Foundation Server (TFS) contrls.  They are TFS Work Item Manager and TFS project dashboard.  Here is the Telerik link.

  • Microsoft Web Platform "offers a complete ecosystem for building and hosting web sites, services, and applications."  Note: When installing the Silverlight 3 Tools, close the rest of your applications.

  • Here is a great site for Cheat Sheets for Developers.  It is called Refcardz DZone.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Adding a Local SSRS Report to WPF Application

clock August 20, 2009 01:34 by author johnstagich

On a previous Windows Forms application, I used the ReportViewer control to display the output of local SQL Server Reporting Services (SSRS) reports in my application.  Unfortunately, there is no native WPF Report Viewer control with similar functionality and there will not be one in .Net 4.0 (according to Jamie Rodriguez at Microsoft).  Anyway, the workaround is to use the WinForms ReportViewer control within WPF.  Below is the code that I used.  I had two WPF Windows that I was working with Windows1.xaml and ReportViewer.xaml.  The ReportViewer Window is where I wanted the output of the report to go.  The name of the report file was rptLocations.rdlc.

// Here is the link where I found the code for this routine (Thanks Sayor!):
// http://sayor.blogspot.com/2008/08/report-viewer-in-wpf-application.html

// Add Using statements
using System.Windows.Forms.Integration;
using Microsoft.Reporting.WinForms;

// Get report data
ObservableCollection<BELocation> locationList = new ObservableCollection<BELocation>();
locationList = objLocation.GetAllLocations();

// Create instance of WindowsFormsHost to integrate the report viewer control with the WPF form.
WindowsFormsHost host = new WindowsFormsHost();

// Create instance of Report Viewer Control
Microsoft.Reporting.WinForms.ReportViewer reportViewer = new Microsoft.Reporting.WinForms.ReportViewer();

// Create instance of ReportViewer.xaml Window. This window will contain the output of the report.
Window win = new ReportViewer();

// Specifying local processing mode for the ReportViewer
reportViewer.ProcessingMode = ProcessingMode.Local;

// Specifying the location of the report definition file.  Use the command below, if you set "Copy to Output Directory" property to one of the
// copy options (Copy Always, Copy if newer) for the rptLocations.rdlc file.

       //reportViewer.LocalReport.ReportPath = "rptLocations.rdlc";

reportViewer.LocalReport.ReportEmbeddedResource = "StagichSoftwareConsulting.WPF_LineOfBusiness.rptLocations.rdlc";

// Create a new ReportDataSource with the name of the DataSource and the object  that is to be used as the DataSource
ReportDataSource ds = new ReportDataSource("BELocation", locationList);

// Add the ReportDataSource to the DataSoure of the ReportViewer
reportViewer.LocalReport.DataSources.Add(ds);

// Causes the current report in the Report Viewer to be processed and rendered.
reportViewer.RefreshReport();

// Sets the child control hosted by the WindowsFormsHost element.
host.Child = reportViewer;

 // Add the WindowsFormsHost element to the Grid in the ReportViewer.xaml
Grid rGrid = (Grid) win.FindName("gridReportViewer");
rGrid.Children.Add(host);

win.ShowDialog();

          

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Search

Calendar

<<  March 2010  >>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Archive

Tags

Categories


Blogroll

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2010

Sign in