示例#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;
            }
        }
示例#2
0
        private static void OnDisplayModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataPager datapager = (DataPager)d;

            if (datapager.Source != null && (DataPager_DisplayMode)e.NewValue != (DataPager_DisplayMode)e.OldValue)
            {
                datapager.GenerateControls();
            }
        }
示例#3
0
        private static void OnNumericButtonCountChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DataPager datapager = (DataPager)d;

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