سؤال

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)
{
}
هل كانت مفيدة؟

المحلول

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);

نصائح أخرى

the absolute path will be

ms-appx:///Assets/book.png
var resource = App.GetResourceStream(new Uri("Assets/book.png", UriKind.Relative));
using (StreamReader sr = new StreamReader(resource.Stream)
{
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top