예제 #1
0
 private void UpdatePager()
 {
     if (this.PaginatedItemsSource != null)
     {
         this.ListPager.ItemsSource = new List <object>(PaginatedItemsSource.OfType <object>());
     }
     else
     {
         this.ListPager.ItemsSource = null;
     }
     _CalculatePageSize();
 }
예제 #2
0
        public void OnLoaded(object sender, EventArgs e)
        {
            var ncc = PaginatedItemsSource as INotifyCollectionChanged;

            if (ncc != null)
            {
                ncc.CollectionChanged += OnPaginatedItemsCollectionChanged;
            }

            this.UpdatePager();

            if (this.PaginatedItemsSource != null)
            {
                this.CurrentItem = PaginatedItemsSource.OfType <object>().FirstOrDefault();
            }
        }
예제 #3
0
        private void OnPaginatedItemsSourceChanged(DependencyPropertyChangedEventArgs e)
        {
            if (IsLoaded)
            {
                INotifyCollectionChanged oldValue = e.OldValue as INotifyCollectionChanged;
                if (oldValue != null)
                {
                    oldValue.CollectionChanged -= OnPaginatedItemsCollectionChanged;
                }

                INotifyCollectionChanged newValue = e.NewValue as INotifyCollectionChanged;
                if (newValue != null)
                {
                    newValue.CollectionChanged += OnPaginatedItemsCollectionChanged;
                }

                UpdatePager();

                if (PaginatedItemsSource != null)
                {
                    CurrentItem = PaginatedItemsSource.OfType <object>().FirstOrDefault();
                }
            }
        }