0
votes

I have an jpg file that is added in VS project within images folder. I can access its path using following

var imagePath = "ms-appx:///images/BookTitle.jpg";

I want to use this image in my app share contract. For this I am following the tutorial at this link. Only issue is that in the tutorial file is selected using filePicker whereas I already have this file within my project. I think I need to use following code but don't know how to set imageFile from imagePath above. Can you please provide any points?

request.data.setBitmap(Windows.Storage.Streams.RandomAccessStreamReference.createFromFile(imageFile));

Any pointer, how

1

1 Answers

2
votes

Try

request.data.setBitmap(Windows.Storage.Streams.RandomAccessStreamReference.createFromUri(imagePath));