PDFsharp & MigraDoc Forum
https://forum.pdfsharp.net/

DocumentPreview in WPF
https://forum.pdfsharp.net/viewtopic.php?f=2&t=2519
Page 1 of 1

Author:  yvesonline [ Tue Jul 16, 2013 2:19 pm ]
Post subject:  DocumentPreview in WPF

Hi!

I'm working with the WPF build of MigraDoc and PDFSharp 1.32. Due to the "lock files" bug I am considering moving to the GDI+ build.
But somehow when I try to include the DocumentPreview
Code:
MigraDoc.Rendering.Forms.DocumentPreview
I get nothing. I call the following in the constructor:
Code:
this.Document = new Document();
// Create the document
// [...]
string ddl = MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToString(this.Document);
this.DocumentPreview = new DocumentPreview();
this.GroupBox.Content = this.DocumentPreview;
this.DocumentPreview.Ddl = ddl;
But nothing happens, no error, no warning, no control which is shown.
So what I am looking for is either to get the DocumentPreview from GDI+ working in my WPF/XAML application or a workaround for the "lock files" bug. Any ideas?

Best regards
Yves

Author:  Thomas Hoevel [ Thu Jul 18, 2013 12:15 pm ]
Post subject:  Re: DocumentPreview in WPF

Hi!

Difficult to tell the problem with just a code snippet.

When using a WinForms dialog, just add DocumentPreview in the designer.

When using a WPF dialog, you need a WindowsFormsHost somewhere AFAIK - and I don't see that in your snippet.

See also:
http://msdn.microsoft.com/en-us/library/ms751761.aspx

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/