1

I'm trying to get print preview to work but I cannot seem to get anything display. I have a form called ScreenShotForm that uses the DocumentViewer. Here is the xaml code:

<Window
x:Class="S3DDesktop.Apps.SchematicDesigner.Dialogs.ScreenShotForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding SchematicDesignerAppStrings.Header_Preview, Source={StaticResource LocalizedStrings}}">
<DocumentViewer
   Name="_viewer" >
    <DocumentViewer.Resources>
        <Style TargetType="ContentControl">
            <Style.Triggers>
                <Trigger Property="Name" Value="PART_FindToolBarHost">
                    <Setter Property="Visibility" Value="Collapsed"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </DocumentViewer.Resources>
</DocumentViewer>

the code behind it simply returns a Document property:

    public IDocumentPaginatorSource Document
    {
        get { return _viewer.Document; }
        set { _viewer.Document = value; }
    }

I then have my view model which I call on the ScreenShotForm in order to get the print preview to work. This is where I'm stuck at. The window pop up just fine, but it does not display any content.

  ScreenShotForm oForm = new ScreenShotForm();
        oForm.DataContext = this;
        oForm.ShowDialog();

I know I'm missing something, but I can't figure it out. :?

Ducle91
  • 13
  • 6

0 Answers0