Pergunta

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.

Foi útil?

Solução 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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top