本文介绍了Visual Studio 2017中的WindowsFormsHost不绘制控件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在WPF窗口中放置一个ReportViewer。
但是当我使用WindowsFormsHost它没有绘制控件时,我用另一个控件测试它,但它不绘制任何控件。
这样:
< Window x:Class =" DocumentManager.Report.Report_Form" xmlns =" schemas.microsoft/winfx/2006/xaml/presentation" xmlns:x =" schemas.microsoft/winfx/2006/xaml" xmlns:d =" schemas.microsoft/expression/blend/2008" xmlns:mc =" schemas.openxmlformats/markup-compatibility/2006" xmlns:local =" clr-namespace:DocumentManager" xmlns:rv =" clr-namespace:Microsoft.Reporting.WinForms; assembly = Microsoft.ReportViewer.WinForms" mc:Ignorable =" d" Title ="Relatórios"高度= QUOT; 450"宽度= QUOT; 800" Style =" {DynamicResource CustomWindowStyle}" WindowStartupLocation = QUOT;中心屏幕"> < Window.Resources> < ResourceDictionary Source =" /Styles/Windows/StyleResources.xaml" /> < /Window.Resources> < Grid> < WindowsFormsHost Margin =" 5"名称= QUOT; windowsFormsHost1"> < rv:ReportViewer x:Name =" _reportViewer" /> < / WindowsFormsHost> < / Grid> < / Window>
解决方案
我发现了问题,为什么我不知道,如果我删除了样式的作品
I want to put a ReportViewer in a WPF Window.
But when I was using WindowsFormsHost it does not paint the control, I tested it with another control, but it does not paint any controls.
Stays like this:
<Window x:Class="DocumentManager.Report.Report_Form" xmlns="schemas.microsoft/winfx/2006/xaml/presentation" xmlns:x="schemas.microsoft/winfx/2006/xaml" xmlns:d="schemas.microsoft/expression/blend/2008" xmlns:mc="schemas.openxmlformats/markup-compatibility/2006" xmlns:local="clr-namespace:DocumentManager" xmlns:rv="clr-namespace:Microsoft.Reporting.WinForms;assembly=Microsoft.ReportViewer.WinForms" mc:Ignorable="d" Title="Relatórios" Height="450" Width="800" Style="{DynamicResource CustomWindowStyle}" WindowStartupLocation="CenterScreen"> <Window.Resources> <ResourceDictionary Source="/Styles/Windows/StyleResources.xaml"/> </Window.Resources> <Grid> <WindowsFormsHost Margin="5" Name="windowsFormsHost1"> <rv:ReportViewer x:Name="_reportViewer"/> </WindowsFormsHost> </Grid> </Window>
解决方案 I discovered the problem, the why I do not know, if I remove the style works.
更多推荐
Visual Studio 2017中的WindowsFormsHost不绘制控件。
发布评论