Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

FFImageLoading is Not Loading Image From App Sandbox in Xamarin.Forms UWP

$
0
0

I am using a Xamarin.Forms UWP app that has image "myicon.png" downloaded to its sandbox location. It's path is like below and I can see it and in Windows Explorer and open the image in MS Paint for example. That prooves that the image exists in the App Sandbox:
"C:/Users/me/AppData/Local/Packages/f040f23f-de21-4722-832d-7b617ef7fbe1_16fy7p00psw5z2/LocalState/se/resources/resources/plugins/spseplugin/myicon.png"

So, the image is not added to project structure (neither PCL nor UWP) but it is available in the app sandbox location.

I am trying to load that image and show it in StackLayout in my UWP app using FFImageLoading library for performance reason as it does image caching. In order to do so, I am doing following:

  1. I have downloaded Nuget for FFImageLoading and it is added to my references
  2. In UWP App.xaml.cs, I added following as per FFImageLoading GitHub documentation instructions:
                        var assembliesToInclude = new List<Assembly>()
                        {
                            typeof(CachedImage).GetTypeInfo().Assembly,
                            typeof(CachedImageRenderer).GetTypeInfo().Assembly
                        };
                        Xamarin.Forms.Forms.Init(e, assembliesToInclude);
  1. In my UWP MainPage.xaml.cs, I added following line in MainPage c-tor just after call to InitializeComponent, also as per FFImageLoading GitHub instructions:
    CachedImageRenderer.Init();

  2. Add xmlns namespace for FFImageLoading library in my XAML:
    xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"

  3. Add FFImageLoading CachedImage to my StackLayout:

        <ff:CachedImage       <-- using CachedImage wont show image. Using Image will show it.
          Source="{Binding ImageUri}"
          WidthRequest="20"
          HeightRequest="20"
          VerticalOptions="Center"
          DownsampleToViewSize="True" />

Above, ImageUri is a property on my view-model and putting break point on it shows that it is set to the image file path I showed above.

Using FFImageLoading CachedImage however is not showing the image when I run my app whereas Image (Xamarin Image View) is showing it fine.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>