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