在Metro mahapps中报告查看器控件

时间:2021-02-24 08:20:44

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

我正在使用wpf应用程序并在Windows窗体主机中使用报表查看器控件。一切都运行正常,直到我使用Metro Mahapps来改进我的应用程序的GUI。报表查看器控件停止呈现。代码是

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

         </winForms:ReportViewer>
    </WindowsFormsHost>

Anybody else have this bug and any proposed solution.

其他任何人都有这个错误和任何建议的解决方案。

2 个解决方案

#1


1  

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.

Mahapps中的窗口(称为MetroWindow)将AllowTransparency(通过BorderlessWindowBehavior,请参阅metrowindow.xaml)设置为true,这将导致渲染问题,例如WebBrowser,我不太清楚为什么会导致此问题,可能是ReportView不支持透明...(你可以问谷歌),如果你想要reportview工作,你必须将此属性设置为false或使用常规窗口。

#2


1  

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

要实现此功能,我们只需要在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.

如果我们有意在用户控件中使用报表查看器控件,我们需要在托管用户控件的窗口中添加这段代码。

#1


1  

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.

Mahapps中的窗口(称为MetroWindow)将AllowTransparency(通过BorderlessWindowBehavior,请参阅metrowindow.xaml)设置为true,这将导致渲染问题,例如WebBrowser,我不太清楚为什么会导致此问题,可能是ReportView不支持透明...(你可以问谷歌),如果你想要reportview工作,你必须将此属性设置为false或使用常规窗口。

#2


1  

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

要实现此功能,我们只需要在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.

如果我们有意在用户控件中使用报表查看器控件,我们需要在托管用户控件的窗口中添加这段代码。