question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Android] CachedImage doesn't load in SFListView until after scrolled off screen

See original GitHub issue

I’m finding some strange behavior whereby when I load a CachedImage into an ItemTemplate within an SFListView, I see a blank space where the image should be until I scroll.

Here’s a template

<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xaml="clr-namespace:MyApp.SelfServe.Mobile.Xaml;assembly=MyApp.SelfServe.Mobile"
             xmlns:forms="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"
             xmlns:controls="clr-namespace:MyApp.SelfServe.Mobile.Controls;assembly=MyApp.SelfServe.Mobile"
             x:Class="MyApp.SelfServe.Mobile.Pages.UserAccount.Projects.Templates.ProjectListTemplate">
    <Grid HorizontalOptions="Fill" VerticalOptions="Fill" Margin="0" Padding="0"
          BackgroundColor="{Binding IsSelected, Converter={StaticResource SfListViewSelectionConverter}}"
          RowSpacing="0">
        <Grid.RowDefinitions>
            <RowDefinition>
                <RowDefinition.Height>
                    <OnPlatform x:TypeArguments="GridLength">
                        <On Platform="Android" Value="120" />
                        <On Platform="iOS" Value="100" />
                    </OnPlatform>
                </RowDefinition.Height>
            </RowDefinition>
            <RowDefinition Height="1" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="50" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="40" />
        </Grid.ColumnDefinitions>

        <BoxView Grid.Column="0"
                 Grid.Row="0"
                 Color="{Binding Phase, Converter={StaticResource ProjectPhaseToColorConverter}, ConverterParameter={Binding HasAlert}}"
                 WidthRequest="5"
                 HeightRequest="999"
                 VerticalOptions="FillAndExpand" />

        <forms:CachedImage Grid.Column="1" 
                           Grid.Row="0"
                           HorizontalOptions="Center"
                           VerticalOptions="Center"
                           Source="{Binding PhaseIcon}" />

        <StackLayout Grid.Column="2"
                     Grid.Row="0"
                     Spacing="2"
                     VerticalOptions="Center">
            <Label Text="{Binding Nickname}" Style="{StaticResource Common-Title}"
                   LineBreakMode="TailTruncation" />
            <Label FormattedText="{Binding RequestNumberFormatted}"
                   LineBreakMode="TailTruncation" />
            <Label FormattedText="{Binding PhaseFormatted}"
                   LineBreakMode="TailTruncation" />
            <Label FormattedText="{Binding SiteIdFormatted}"
                   LineBreakMode="TailTruncation" />
            <Label FormattedText="{Binding LocationFormatted}"
                   LineBreakMode="TailTruncation" />
        </StackLayout>

        <controls:TintedCachedImage
            Grid.Column="3"
            Grid.Row="0"
            Source="arrow.png"
            HorizontalOptions="Center"
            VerticalOptions="Center"
            TintColor="{Binding Phase, Converter={StaticResource ProjectPhaseToColorConverter}, ConverterParameter={Binding HasAlert}}"
            InputTransparent="True"
            IsVisible="{Binding IsBusy, Converter={StaticResource InverseBoolConverter}}" />

        <ActivityIndicator Grid.Column="3"
                           Grid.Row="0"
                           IsVisible="{Binding IsBusy}"
                           IsRunning="{Binding IsBusy}" />
        <BoxView Grid.Column="0"
                 Grid.Row="1"
                 Grid.ColumnSpan="4"
                 HeightRequest="1"
                 HorizontalOptions="FillAndExpand"
                 Color="{xaml:ResxColor PrimaryDarkBlue}" />
    </Grid>
</ContentView>

Page Load one

Partial Scroll Down two

After Scroll down and back to top three

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ChaseFlorellcommented, Nov 13, 2017

@daniel-luberda, that last update works, thanks

1reaction
daniel-luberdacommented, Nov 13, 2017

Yes, I want to fix issue 808 and release next stable today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Listview not loading images till I scroll the screen
1 Answer 1 ... As Listview use the concept of recycling its view. The images are not showing when the async call finish....
Read more >
Working with ListView in Xamarin ListView (SfListView)
When the SfListView is loaded inside the ScrollView with the height of total items, scrolling will not occur in the SfListView only when...
Read more >
Scrolling in Xamarin ListView (SfListView)
If the item is already in view, scrolling will not occur. Start: Scrolls a specific item to be positioned at the begin of...
Read more >
Valley immediate care grants pass oregon
I have problem with scroll many downloaded images (displaying by url) in listview. I'm a beginner of Xamarin Forms. Or you can use...
Read more >
Xamarin Scrollview only showing partial data up to screen ...
Hello, I have a frame with a stacklayout inside of a scrollview, when I open the page, labels and data show up, but...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found