Search code examples
c#wpfreportviewerwindowsformshostmahapps.metro

Report viewer control in Metro mahapps


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.


Solution

  • 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.