ListView Fast Scroll will launch application on internet images in DataTemplate

I have internet images in my list data sheet as shown below. This is a simple mvvm binding, I don't use any code at all. When scrolling is done quickly in the list, it freezes. it looks like it's caused by multiple downloads. maybe a dead end (?) I am using ffimageloading, but I tried using an XF image and the problem also occurs with it.

I see in the ffimageloading documentation there is mention of the scrollstatechanged event, but I cannot find it in the xamarin. It looks like the suggested solution is android native level. It certainly makes sense not to have it in XF, because it's Android specific. Question: How can I use this event if it's a solution? If not, is there any other solution for this problem?

I've tested in UWP, flinging doesn't cause any performance or hang.

 <DataTemplate>
      <Grid ColumnSpacing="0" >
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="*"></ColumnDefinition>
             <ColumnDefinition Width="2*"></ColumnDefinition>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*"></RowDefinition>
                                    </Grid.RowDefinitions>
                                    <ffimageloading:CachedImage  RetryCount="1"   TransparencyEnabled = "false"   CacheDuration = "120"
                                                              LoadingPlaceholder="loading.png"   FadeAnimationEnabled="True"    CacheType="Disk" 
                                                              InputTransparent="True"     ErrorPlaceholder="thumb.png"
                                                    Source="{Binding Images, Converter={StaticResource thumbnailConvertor}}"
                             Aspect="AspectFit"  Grid.Row="0" Grid.Column="0"  />
                                    <StackLayout Orientation="Vertical" Grid.Row="0" Grid.Column="1"  >
                                        <Label Text="{Binding name}"  FontSize="20" FontAttributes="Bold"                            

                                    </StackLayout>
                                </Grid>
                            </DataTemplate>

      

ScrollStateChanged event in Xamarin Android

_

myListView.ScrollStateChanged += (object sender, ScrollStateChangedEventArgs scrollArgs) => {
  switch (scrollArgs.ScrollState)
  {
    case ScrollState.Fling:
      ImageService.Instance.SetPauseWork(true); // all image loading requests will be silently canceled
      break;
    case ScrollState.Idle:
      ImageService.Instance.SetPauseWork(false); // loading requests are allowed again

      // Here you should have your custom method that forces redrawing visible list items
      _myListView.ForcePdfThumbnailsRedraw();
      break;
  }
};

      

EDIT: Xamarin Forms USING 2.3.5 Pre6

I tried using the latest preview as xamarin claims improvements with fast renders, but it looks like things have gotten even worse. The listview instantly becomes frozen even without scrolling when the listview appears.

+3


source to share





All Articles