Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

The most optimal way to reload data e.g. inside scrollView or ListView

$
0
0

Hi, I am struggling with problem with efficiency of my application, I am focusing on speed right now and I want to improve every functionality as much as it possible.
First case is that:
I have a page where Scrollview is placed, I want to reload this scrollview every time user get to this page. Everything is placed inside Tabbed page so, e.g when you are on page which is adjacent to this, slide to our page and make reload. For now I have logic which is placed below, but it is like you can see that when you are sliding fast between you see something is bad, I am not saying that is terrible, but I belive there is better way to to this, Thanks for your time and help.
My ScrollView
``` **

<StackLayout

            BackgroundColor="#0249D7"
            BindableLayout.ItemsSource="{Binding CalendarDates}"
            Orientation="Horizontal">
                    <BindableLayout.ItemTemplate>
                        <DataTemplate>
                            <StackLayout HorizontalOptions="Start">
                                <StackLayout WidthRequest="50" HeightRequest="130" BackgroundColor="#0249D7">
                                    <Label x:Name="date" IsVisible="False" Text="{Binding EntireDate}"></Label>
                                    <Label Text="{Binding Day}" HorizontalTextAlignment="Center"/>
                                    <Label  Text="{Binding DayOfWeek}" HorizontalTextAlignment="Center"/>
                                    <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
                                        <BoxView  WidthRequest="7" HeightRequest="7"  CornerRadius="32" HorizontalOptions="Center" IsVisible="{Binding ContainsRejected}" BackgroundColor="#ff4343"/>
                                        <BoxView  WidthRequest="7" HeightRequest="7" CornerRadius="32" HorizontalOptions="Center" IsVisible="{Binding ContainsTo_Approved}"   BackgroundColor="#ffb143"/>
                                        <BoxView  WidthRequest="7" HeightRequest="7"  CornerRadius="32" HorizontalOptions="Center" IsVisible="{Binding ContainsApproved}"  BackgroundColor="#1ccc04"/>
                                    </StackLayout>
                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer  Command="{Binding BindingContext.GetMeetingFromDayCommand, Source={x:Reference Name=calendarPage}}"
                                    CommandParameter="{Binding Source={x:Reference date}, Path=Text}"/>
                                    </StackLayout.GestureRecognizers>
                                </StackLayout>
                            </StackLayout>

                        </DataTemplate>
                    </BindableLayout.ItemTemplate>
                </StackLayout>
            </ScrollView>

**```

My code behind

 protected override async void OnAppearing()
        {
            base.OnAppearing();
            await refreshMeetings();
        }        

        private async Task refreshMeetings()
        {
            var viewModel = (CalendarViewModel)BindingContext;
            await viewModel.InitializeAsync();
        }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>