How to maintain a downloading progress of list view item in Xamarin Forms

cherantcherant USMember ✭✭
edited September 2017 in Xamarin.Forms

I am using ListView that contains item template to show book information with download button ( Contains Image of book, Title, Author and button to download book).

Need to show download progress while click download button of each book. I have managed progress value in separate class and used that separate class object to maintain progress of each book in collection. Like below,

When scrolling the page download progress value for downloading books becomes null. For example in the above screenshot, download progress value shown null when scroll the view. Could you please suggest on this?


  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @cherant ,
    Ideally that shouldn't happen if you use the Async calls, However SyncF controls are weird, I too have some super silly things pending in bucket with them. First check if your downloading method call are not executing in the main thread, because it can be the reason I can think of right now for your UI is not working as expected.

  • cherantcherant USMember ✭✭

    Hi @N_Baua ,
    Thanks for your update.

    I have used Microsoft List View only. Async calls only used for every button click. Downloading method calls are not executing in Main thread. I have bind the progress value into progressbar in xaml and now progress shows properly.

  • N_BauaN_Baua INMember ✭✭✭✭✭

    Hi @cherant ,

    Did it solved now?

  • JohnHardmanJohnHardman GBUniversity mod

    @cherant - You'll need to post the code for your view model and page, including the template for the ViewCell, for anybody to identify the cause. Without the code, my guess would be that ListView caching is resulting in re-use of a cell, or alternatively that ListView caching is resulting in something being freed up.

  • cherantcherant USMember ✭✭

    Hi @N_Baua ,

    Yes, now issue resolved. Issue occurred because set caching strategy as Recycle element for list view to improve performance. I have bind download property into ProgressBar panel.

  • NewCoder1973NewCoder1973 Member ✭✭

    Hi guys I need to add a progressbar inside my listview, the Progress of my ProgreesBar will get its value from data coming from database. Anyone can help me with the task? thanks in advance!

    <?xml version="1.0" encoding="utf-8" ?>

        <ListView x:Name="LV2">
                            <ProgressBar x:Name="myProgressBar2" Progress="0.0" ProgressColor="Red" />
                            <Label x:Name="Lb_1" TextColor="Green" Text="{Binding Value3}"/>
        <StackLayout Orientation="Vertical" VerticalOptions="Fill" HorizontalOptions="Fill">
            <Button Text="Týkla" Clicked="onClicked" Margin="20,5,20,5"></Button>

    and the code behinde

    using System;
    using System.Collections.ObjectModel;
    using Xamarin.Forms;

    namespace App17
    public partial class MainPage : ContentPage
    public class SInfo

            public string Value3 { get; set; }
            public MainPage()
            Value2 = 0.8;
            var listView = new ListView();
            LV2.ItemsSource = ListViewSource;
        ObservableCollection<SInfo> ListViewSource = new ObservableCollection<SInfo>();
        public string Value3{get; private set;}
        public double Value4 { get; private set; }
        private void onClicked(object sender, EventArgs e)
           Double Value4= Value2;
            ListViewSource.Add(item: new SInfo { Value3= "ABC" });
            myProgressBar2.ProgressTo(Value4, 9950, Easing.SpringIn);


    Error CS1061 'object' does not contain a definition for 'ProgressTo' and no accessible extension method 'ProgressTo' accepting a first
    argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

  • Amar_BaitAmar_Bait DZMember ✭✭✭✭✭
    edited June 28

    My reaction when seeing your code:

    No offense just joking :)

    Lot of problems in your code:

    • Using code behind files for logic instead of an MVVM approach
    • Variables names: Value2? Value3? Value4? LV2?
    • I don't see any logic for download progress... you're just simulating it with your ProgressTo call...

    Here are some links you have to read/understand before trying to do anything:

Sign In or Register to comment.