I have a WPF application in which the GUI displays a few different aspects of the application to the user, using a different tab
for each part of the application. I am now looking to add the functionality to load and view document from within the application on one of the tabs.
I have added a DocumentViewer
to the tab, and can see that it is displayed in the GUI when I run my application, but I'm not sure how to get that DocumentViewer
to load/ display a document, and can't seem to find any method calls/ markup that enable you to do this.
The XAML markup I am using to add the DocumentViewer
to my application is:
<TabItem Header="Document Viewer">
<StackPanel>
<DocumentViewer x:Name="docViewer" Height="643" Margin="0,0,-0.4,0"/>
<DocumentViewer x:Name="documentViewer" Height="1" Margin="0,0,-0.4,0" RenderTransformOrigin="0.5,0.5">
<DocumentViewer.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</DocumentViewer.RenderTransform>
</DocumentViewer>
</StackPanel>
</TabItem>
How do I point this DocumentViewer
to a PDF (or .doc, or whatever) file that's located on my computer, so that it will load and display that document inside my application window?