Example #1
0
        private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataPager datapager = (DataPager)d;

            if (e.NewValue != null && e.NewValue != e.OldValue)
            {
                if (e.OldValue != null)
                {
                    ((PagedCollectionView)e.OldValue).CollectionChanged -= datapager.Source_CollectionChanged;
                    ((PagedCollectionView)e.OldValue).PageChanged       -= datapager.Source_PageChanged;
                }

                datapager.Source.PageSize = datapager.PageSize;

                datapager.NumberOfPages = datapager.CountNumberPage();

                datapager.CurrentPage = datapager.CurrentPage; // re run the check because the current page can now be out of bounds

                datapager.Source.CollectionChanged += datapager.Source_CollectionChanged;

                datapager.Source.PageChanged += datapager.Source_PageChanged;

                datapager.GenerateControls();
            }
            else
            {
                datapager.NumberOfPages = 0;
            }
        }
Example #2
0
        /// <summary>
        /// the data PageSize
        /// </summary>
        /// <param name="d">TempCanvas that changed its SelectedDate.</param>
        /// <param name="e">The DependencyPropertyChangedEventArgs.</param>
        private static void OnPageSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataPager datapager = (DataPager)d;

            if (e.NewValue != null && datapager.Source != null && (int)e.NewValue != (int)e.OldValue)
            {
                datapager.Source.PageSize = (int)e.NewValue;

                datapager.NumberOfPages = datapager.CountNumberPage();
            }
        }