Exemple #1
0
 private void OnItemAppearing(object sender, ItemVisibilityEventArgs e)
 {
     if (ItemAppearingCommand != null)
     {
         ItemAppearingCommand?.Execute(e.Item);
     }
 }
        private void OnItemAppearing(object sender, ItemVisibilityEventArgs e)
        {
            if (ItemAppearingCommand != null)
            {
                ItemAppearingCommand?.Execute(e.Item);
            }

            if (LoadMoreCommand != null)
            {
                if (IsGroupingEnabled)
                {
                    if (PageSize == null)
                    {
                        var firstItem = ((IList)ItemsSource.Cast <object>().First()).Cast <object>().First();

                        if (e.Item == firstItem && !IsRefreshing)
                        {
                            LoadMoreCommand?.Execute(null);
                        }
                    }
                    else
                    {
                        var firstItem = ((IList)ItemsSource.Cast <object>().First()).Cast <object>().First();

                        var totalItems = 0;
                        foreach (var item in ItemsSource.Cast <object>())
                        {
                            totalItems = totalItems + ((IList)item).Cast <object>().Count();
                        }

                        if (e.Item == firstItem && !IsRefreshing
                            & totalItems >= PageSize.Value)
                        {
                            LoadMoreCommand?.Execute(null);
                        }
                    }
                }
                else
                {
                    if (PageSize == null)
                    {
                        if (e.Item == ItemsSource.Cast <object>().First() && !IsRefreshing)
                        {
                            LoadMoreCommand?.Execute(null);
                        }
                    }
                    else
                    {
                        if (e.Item == ItemsSource.Cast <object>().First() && !IsRefreshing
                            & ItemsSource.Cast <object>().Count() >= PageSize.Value)
                        {
                            LoadMoreCommand?.Execute(null);
                        }
                    }
                }
            }
        }
        // If the new item that is appearing on the screen is the last one in the
        // collection, we execute the LoadMoreCommand so our ViewModel knows we
        // want to load more data for our user from the data service.
        private void OnItemAppearing(object sender, ItemVisibilityEventArgs e)
        {
            ItemAppearingCommand?.Execute(e.Item);

            //If its the last item execute command and load more data.
            if (e.Item == ItemsSource.Cast <object>().Last())
            {
                LoadMoreCommand?.Execute(null);
            }
        }
Exemple #4
0
 private void OnItemAppearing(object sender, ItemVisibilityEventArgs e)
 {
     if (ItemAppearingCommand != null)
     {
         ItemAppearingCommand?.Execute(e.Item);
     }
     if (LoadMoreCommand != null)
     {
         if (e.Item == ItemsSource.Cast <object>().Last())
         {
             LoadMoreCommand?.Execute(null);
         }
     }
 }