コード例 #1
0
        /// <summary>
        /// Обработать элементы вверху.
        /// </summary>
        private async void ProcessUp()
        {
            isUpWorks = true;
            ISupportUpDownIncrementalLoading collection = null;

            if (ItemsSource != null)
            {
                collection = ItemsSource as ISupportUpDownIncrementalLoading;

                if (collection == null)
                {
                    var source = ItemsSource as CollectionViewSource;
                    if (source != null)
                    {
                        collection = source.Source as ISupportUpDownIncrementalLoading;
                    }
                }
            }
            else
            {
                collection = listView.ItemsSource as ISupportUpDownIncrementalLoading;
            }

            if (collection != null && collection.HasMoreUpItems)
            {
                var itemToScroll = await collection.LoadUpAsync((uint)NumberItemsToLoad);

                if (itemToScroll != null)
                {
                    listView.ScrollIntoView(itemToScroll);
                }
                if (sv.VerticalOffset == 0)
                {
                    sv.ChangeView(null, 1, null, true);
                }
            }

            isUpWorks = false;
        }
コード例 #2
0
        /// <summary>
        /// Обработать элементы внизу.
        /// </summary>
        private async void ProcessDown()
        {
            isDownWorks = true;

            ISupportUpDownIncrementalLoading collection = null;

            if (ItemsSource != null)
            {
                collection = ItemsSource as ISupportUpDownIncrementalLoading;

                if (collection == null)
                {
                    var source = ItemsSource as CollectionViewSource;
                    if (source != null)
                    {
                        collection = source.Source as ISupportUpDownIncrementalLoading;
                    }
                }
            }
            else
            {
                collection = listView.ItemsSource as ISupportUpDownIncrementalLoading;
            }

            if (collection != null && collection.HasMoreDownItems)
            {
                var itemToScroll = await collection.LoadDownAsync((uint)NumberItemsToLoad);

                if (itemToScroll != null)
                {
                    listView.ScrollIntoView(itemToScroll);
                }
            }

            isDownWorks = false;
        }