title: ReportViewer in MVVM WPF
body: <p>I'm building an MVVM Light WPF app using Visual Studio 2015. The app needs to display some SQL Server Reporting Services reports locally. </p>
  
  <p>The following two solutions exist:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/837625/using-ms-reportviewer-in-wpf/">Using MS ReportViewer in WPF</a></li>
  <li><a href="https://msdn.microsoft.com/en-us/library/hh273267.aspx" rel="nofollow noreferrer">Walkthrough: Using ReportViewer in a WPF Application</a></li>
  </ul>
  
  <p>Though the first is MVVM, it's mixing UI with the view model. The second is pure code-behind. </p>
  
  <p>Here's what the first example suggests:</p>
  
  <pre><code>WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
  reportViewer = new ReportViewer();
  windowsFormsHost.Child = reportViewer;
  this.Viewer = windowsFormsHost
  </code></pre>
  
  <p>Note that <code>ReportViewer</code> is a UI control. The second solution uses a code-behind file:</p>
  
  <pre><code>private void ReportViewer_Load(object sender, EventArgs e)
  {
     //...
  }
  </code></pre>
  
  <p>Is there a way to embed a local SSRS report into a WPF app and follow good MVVM practices? Thank you.</p>
  
  <p><strong>Update</strong>: No need to be fanatical! If some code-behind is needed, I'm okay with it.</p>