Question

I am working on a wpf application and using report viewer control in windows form host. Everything was working fine, until I use Metro Mahapps to improve the GUI of my application. Report viewer control stops rendering. The code is

  <WindowsFormsHost x:Name="WindowsFormHostCustomer" Grid.Row="3">
          <winForms:ReportViewer  x:Name="rptViewerCustomers">

         </winForms:ReportViewer>
    </WindowsFormsHost>

Anybody else have this bug and any proposed solution.

Was it helpful?

Solution 2

To achieve this functionality, we just need to add this code in the xaml

    <i:Interaction.Behaviors>
        <behaviours:BorderlessWindowBehavior ResizeWithGrip="True" AllowsTransparency="False" />
    </i:Interaction.Behaviors>

If we have intentions to use report viewer control in user controls, we need to add this piece of code in the window which is hosting the user control.

OTHER TIPS

The window in Mahapps(called MetroWindow) will set AllowsTransparency(via BorderlessWindowBehavior, see metrowindow.xaml) to true which will cause issue in rendering, such as WebBrowser, I am not quite clear why this cause this issue, probably ReportView doesn't support transparent...(you can ask google), if you want reportview work, you must set this property to false or use regular window.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top