Reputation: 301
Can you give me clarity about how to load the image from the local folder (I mean from D: drive rather than the local cache folder)?
I tried to refer an image from my D: drive, but it's not shown.
image.Source = ImageSource.FromFile("D:/ImageFilters/FilterUWP/Filter_UWP_SkiaSharp/Buldingimage.jpeg");
May I know it is not worked? Is there amy way to load the image from the D: drive?
image.Source = ImageSource.FromFile("C:/Users/SanthiyaArulsamy/AppData/LocalState/image.jpg");
Worked from my UWP App.
Please explain to me about the FromFile and also the local folder concept?
Upvotes: 0
Views: 569
Reputation: 9742
Assuming that you are only targeting UWP, not iOS/Android (D:\
would make no sense in this case), please read the documentation for UWP apps
Universal Windows Platform (UWP) apps can access certain file system locations by default. Apps can also access additional locations through the file picker, or by declaring capabilities. (source)
According to this section, there is a capability, broadFileSystemAccess
, you can declare in your packages XAML file
<Package ...
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp uap5 rescap">
<Capabilities>
<rescap:Capability Name="broadFileSystemAccess" />
</Capabilities>
</Package>
If the user has granted, you may access
All files that the user has access to. For example: documents, pictures, photos, downloads, desktop, OneDrive, etc.
Anyway, the documentation mentions two caveats
Because users can grant or deny the permission any time in Settings, you should ensure that your app is resilient to those changes.
and
If you submit an app to the Store that declares this capability, you will need to supply additional descriptions of why your app needs this capability, and how it intends to use it.
Upvotes: 1