Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to get the relative path of a file--WPF

$
0
0

I am trying to display fixed documents in a WPF application.  I was able to do this with both DocumentViewer and WebBrowser controls.  But I had to use the absolute file path to get each to work:

DocumentDisplay.Navigate("...\...\Documents\Model Title.pdf")

Dim xpsDoc As New XpsDocument("...\...\Documents\Model Title.xps", FileAccess.Read)
        DocViewer.Document = xpsDoc.GetFixedDocumentSequence()
        xpsDoc.Close()

I want to use a relative file path in my application.  I have seen several examples where some use Application.StartUpPath() and others using Pack URI's.  The first option looks the easiest but I am having trouble finding the namespace to reference.  The Pack URI option looks much more complicated, but maybe that is just me.  I use VB.  Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>