private void UpdatePager() { if (this.PaginatedItemsSource != null) { this.ListPager.ItemsSource = new List <object>(PaginatedItemsSource.OfType <object>()); } else { this.ListPager.ItemsSource = null; } _CalculatePageSize(); }
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(); } }
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(); } } }