user2970840
user2970840

Reputation: 1361

what is the complete path of an image in asset folder?

I know a file's relative path:

Uri("/Assets/book.png", UriKind.Relative)

But what is its absolute path? I want to use it here:

using (StreamReader sr = new StreamReader(completePath)
{
}

Upvotes: 3

Views: 5583

Answers (3)

palota
palota

Reputation: 642

var resource = App.GetResourceStream(new Uri("Assets/book.png", UriKind.Relative));
using (StreamReader sr = new StreamReader(resource.Stream)
{
}

Upvotes: 0

asitis
asitis

Reputation: 3031

The absolute image path is

 ms-appx:///Assets/book.png 

where ms-appx points to the Local app install folder. And you can use as

var uri = new Uri("ms-appx:///Assets/book.png", UriKind.Absolute);

Upvotes: 3

Sandeep Chauhan
Sandeep Chauhan

Reputation: 1313

the absolute path will be

ms-appx:///Assets/book.png

Upvotes: 1

Related Questions