Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

ListView with Image in ItemTemplate slightly laggy

$
0
0

So I am loading about 200 items into my ListView, using the following item template

<ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell>
            <StackLayout HorizontalOptions="StartAndExpand" Orientation="Horizontal">
              <Image WidthRequest="21" HeightRequest="25" Source="{Binding NoteTypeImage}" />
              <StackLayout Padding="5,0,0,0" VerticalOptions="StartAndExpand" Orientation="Vertical">
                <Label Text="{Binding NotedByFullName}" YAlign="Center" Font="Medium" />
                <Label Text="{Binding NotedOn}" YAlign="Center" Font="Micro" />
              </StackLayout>
            </StackLayout>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>

My question is, is it laggy because it needs to fetch the image from the url for every single item (no caching involved)?
There are 3 different images that display, depending on a condition.

Would it be possible, to define the 3 images as static resources and then bind to the right one somehow?
If this is possible, will it fix the laggy issue?


Viewing all articles
Browse latest Browse all 58056

Trending Articles