2010-06-11 101 views

回答

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 
相關問題