Visual Studio 2017中的WindowsFormsHost不绘制控件。 [英] WindowsFormsHost in Visual Studio 2017 is not painting the control.

查看:94
本文介绍了Visual Studio 2017中的WindowsFormsHost不绘制控件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在WPF窗口中放置一个ReportViewer。


但是当我使用WindowsFormsHost它没有绘制控件时,我用另一个控件测试它,但它不绘制任何控件。


这样:


< Window x:Class =" DocumentManager.Report.Report_Form" 
xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x =" http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d =" http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc =" http://schemas.openxmlformats.org/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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/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不绘制控件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆