目前有not an available WPF viewer for Active Reports 6。我试图使用主机控件在互操作主机中显示查看器,但我没有太多运气。有没有其他人成功尝试过这个?我甚至无法将包装器Viewer控件添加到项目工具箱中作为自定义控件。我希望避免再造轮子。
答案 0 :(得分:2)
现有的ActiveReports Viewer在WPF中运行良好。您可以使用以下XAML在WPF中托管它:
<Window x:Class="ARViewerHostedInWpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:arv="clr-namespace:DataDynamics.ActiveReports.Viewer;assembly=ActiveReports.Viewer6"
Title="MainWindow" Height="350" Width="525" Loaded="Window_Loaded">
<Grid>
<WindowsFormsHost Name="windowsFormsHost1">
<arv:Viewer x:Name="ARViewer" Dock="Fill" />
</WindowsFormsHost>
</Grid>
</Window>
XAML文件代码隐藏中的以下代码将报表连接到上面的XAML中的查看器并运行它:
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
NewActiveReport1 rpt = new NewActiveReport1();
this.ARViewer.Document = rpt.Document;
rpt.Run();
}
}
我正在使用currently available version of ActiveReports 6对此进行测试。
希望这有帮助!
Scott Willeke
GrapeCity