6 changed files with 90 additions and 18 deletions
@ -0,0 +1,63 @@ |
|||||||
|
/* |
||||||
|
* Created by SharpDevelop. |
||||||
|
* User: Peter Forstmeier |
||||||
|
* Date: 08.06.2011 |
||||||
|
* Time: 19:41 |
||||||
|
* |
||||||
|
* To change this template use Tools | Options | Coding | Edit Standard Headers. |
||||||
|
*/ |
||||||
|
using System; |
||||||
|
using System.ComponentModel; |
||||||
|
using System.Windows.Documents; |
||||||
|
|
||||||
|
using ICSharpCode.Reports.Core.Exporter.ExportRenderer; |
||||||
|
|
||||||
|
namespace ICSharpCode.Reports.Core.WpfReportViewer |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of PreviewViewModel.
|
||||||
|
/// </summary>
|
||||||
|
public class PreviewViewModel:INotifyPropertyChanged |
||||||
|
{ |
||||||
|
|
||||||
|
private IDocumentPaginatorSource document; |
||||||
|
|
||||||
|
public PreviewViewModel(ReportSettings reportSettings, PagesCollection pages) |
||||||
|
{ |
||||||
|
this.Pages = pages; |
||||||
|
FixedDocumentRenderer renderer = FixedDocumentRenderer.CreateInstance(reportSettings,Pages); |
||||||
|
|
||||||
|
renderer.Start(); |
||||||
|
renderer.RenderOutput(); |
||||||
|
renderer.End(); |
||||||
|
OnNotifyPropertyChanged("Pages"); |
||||||
|
this.Document = renderer.Document; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public PagesCollection Pages {get;private set;} |
||||||
|
|
||||||
|
|
||||||
|
public IDocumentPaginatorSource Document |
||||||
|
{ |
||||||
|
get {return document;} |
||||||
|
set { |
||||||
|
this.document = value; |
||||||
|
OnNotifyPropertyChanged ("Document"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged; |
||||||
|
|
||||||
|
void OnNotifyPropertyChanged(string num0) |
||||||
|
{ |
||||||
|
if (PropertyChanged != null) { |
||||||
|
PropertyChanged(this,new PropertyChangedEventArgs(num0)); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,12 +1,17 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||||
<UserControl |
<UserControl |
||||||
x:Class="ICSharpCode.Reports.Core.WpfReportViewer.WpfReportViewer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
x:Class="ICSharpCode.Reports.Core.WpfReportViewer.WpfReportViewer" |
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||||
|
<!-- {Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}} --> |
||||||
<Grid> |
<Grid> |
||||||
|
|
||||||
<DocumentViewer |
<DocumentViewer |
||||||
x:Name="DocumentViewer" |
x:Name="DocumentViewer" |
||||||
|
Document="{Binding Path=DataContext.Document, |
||||||
|
PresentationTraceSources.TraceLevel=High, |
||||||
|
RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" |
||||||
HorizontalAlignment="Stretch" |
HorizontalAlignment="Stretch" |
||||||
VerticalAlignment="Stretch" |
VerticalAlignment="Stretch"></DocumentViewer> |
||||||
Width="984"></DocumentViewer> |
|
||||||
</Grid> |
</Grid> |
||||||
</UserControl> |
</UserControl> |
Loading…
Reference in new issue