简体   繁体   中英

Windows RT PNG file access on an external USB hard drive

I'm very confused about accessing PNG files on my USB external hard drive.

Even tough I've added the Removable Storage capability and added the .png file type to the declaration tab, every time I try to bind an image from XAML

i.e:(Source="{Binding MyImagePathName}") 

nothing gets binded.

I tried programmatic access to the location and manual binding in C# to an image control and it raised the image load failed.

However I tried the same techniques, but with the app installation folder instead and it miraculously works. What am I doing wrong, am I missing a piece of information?

Note: It does work with .json files but not the .png .

Help I'm struggling with that for a week now!

Seems that there is an internal mechanic that prevent a direct binding using a path (sand box environment I presume), even tough you have enabled Removable Storage capability. I resolved by loading the bitmap image in stream (using code) and assigning the bitmapimage to a property in my data object, then bind in XAML using that property instead of the path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM