Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/263.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WPF ReportDocument类型中的报表查看器不工作_C#_Wpf_Report_Reportviewer - Fatal编程技术网

C# WPF ReportDocument类型中的报表查看器不工作

C# WPF ReportDocument类型中的报表查看器不工作,c#,wpf,report,reportviewer,C#,Wpf,Report,Reportviewer,我试图在VS2017的WPF应用程序中显示报告文件。CS1代码工作完美,需要连接数据。在CS2中,我想通过ReportDocument来实现这一点,但我只有灰色背景的等待轮,并且查看器不要求连接数据。知道怎么做吗?我需要用CS2方法来做 CS1: CS2: 我的XAML: <UserControl x:Class="ReportingPortal.Views.ReportingPortalFilterView" xmlns="http://schemas.microsoft.com/win

我试图在VS2017的WPF应用程序中显示报告文件。CS1代码工作完美,需要连接数据。在CS2中,我想通过ReportDocument来实现这一点,但我只有灰色背景的等待轮,并且查看器不要求连接数据。知道怎么做吗?我需要用CS2方法来做

CS1:

CS2:

我的XAML:

<UserControl
x:Class="ReportingPortal.Views.ReportingPortalFilterView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="clr-namespace:UCM.Infrastructure.Behaviors;assembly=UCM.Infrastructure"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cr="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
lex:LocalizeDictionary.DesignCulture="de"
lex:ResxLocalizationProvider.DefaultAssembly="ReportingPortal"
lex:ResxLocalizationProvider.DefaultDictionary="Resources"
prism:ViewModelLocator.AutoWireViewModel="True"
KeyboardNavigation.TabNavigation="Cycle"
mc:Ignorable="d">
<Grid Background="{DynamicResource LightLightBaseColorBrush}">

    <cr:CrystalReportsViewer
        x:Name="cryrep"
        Width="1000"
        Height="1600"
        Margin="-14,0,0,0"
        HorizontalAlignment="Left"
        VerticalAlignment="Top" />

</Grid>


我必须安装CrforVS运行时,现在它工作得非常完美

CrystalDecisions.CrystalReports.Engine.ReportDocument crReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
crReportDocument.Load("C:\\Reports\\GeneralBusiness\\testDB.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy);

cryrep.ViewerCore.ReportSource = crReportDocument;
cryrep.ViewerCore.RefreshReport();
<UserControl
x:Class="ReportingPortal.Views.ReportingPortalFilterView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="clr-namespace:UCM.Infrastructure.Behaviors;assembly=UCM.Infrastructure"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:cr="clr-namespace:SAPBusinessObjects.WPF.Viewer;assembly=SAPBusinessObjects.WPF.Viewer"
xmlns:lex="http://wpflocalizeextension.codeplex.com"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
lex:LocalizeDictionary.DesignCulture="de"
lex:ResxLocalizationProvider.DefaultAssembly="ReportingPortal"
lex:ResxLocalizationProvider.DefaultDictionary="Resources"
prism:ViewModelLocator.AutoWireViewModel="True"
KeyboardNavigation.TabNavigation="Cycle"
mc:Ignorable="d">
<Grid Background="{DynamicResource LightLightBaseColorBrush}">

    <cr:CrystalReportsViewer
        x:Name="cryrep"
        Width="1000"
        Height="1600"
        Margin="-14,0,0,0"
        HorizontalAlignment="Left"
        VerticalAlignment="Top" />

</Grid>