locked
Slow image source binding RRS feed

  • Question

  • User385023 posted

    I have an image that is displayed on every page that is source bound, and whenever I go to a new page it takes half a second to a second to load that image. Is there some way I can make sure this image is rendered before the page is shown to the user?

    A little background: The image is loaded using PCLStorage when the app starts up, and stored in the App.xaml.cs so that it can be accessed from the base view model that my view models inherit from. This allows the source binding to work on every page, but it also means that the image is always loaded when the binding executes, which I assume is after the rest of the page has been loaded.

    I can't just define the image source in the XAML because the image could filename could vary, and the image is saved programatically. Unless there's some method to set image source in XAML using the PCLStorage absolute file path (assuming that would be quicker at loading than my current method)

    Thanks in advance

    Thursday, May 9, 2019 1:06 PM

Answers

  • User2148 posted

    https://github.com/luberda-molinet/FFImageLoading

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 9, 2019 1:08 PM
  • User371688 posted

    Yes, we recommend you use the Xamarin.FFImageLoading Nuget just as AlessandroCaliaro said, which is very convenient to use. Besides, the github project also have a sample, you can refer to it. The link is : https://github.com/luberda-molinet/FFImageLoading/tree/master/samples

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, May 10, 2019 2:02 AM

All replies

  • User2148 posted

    https://github.com/luberda-molinet/FFImageLoading

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, May 9, 2019 1:08 PM
  • User371688 posted

    Yes, we recommend you use the Xamarin.FFImageLoading Nuget just as AlessandroCaliaro said, which is very convenient to use. Besides, the github project also have a sample, you can refer to it. The link is : https://github.com/luberda-molinet/FFImageLoading/tree/master/samples

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Friday, May 10, 2019 2:02 AM
  • User385023 posted

    @AlessandroCaliaro @jezh Thanks guys, I'm just implementing it at the moment, didn't get round to it yesterday

    Friday, May 10, 2019 8:21 AM
  • User385023 posted

    @jezh That works well!

    Do you happen to know if there's any method to utilise this with ImageButton? I'm not sure how I'd implement that and can't seem to find many people that have for Cross platform Xamarin Forms..

    Friday, May 10, 2019 11:46 AM