Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Is a page rendered for print after the paginator executes MoveToPosition?
posted

I've got the following code in an implementation of IEmbeddedVisualPaginator:

         public bool MoveToNextPage()
        {
            if (_reportSettings.PageRange.PageTo > 0 && _logicalPageNumber >= _reportSettings.PageRange.PageTo)
                return false;

            IEnumerable<EmploymentSeriesError> myPageData = myDataSource.Skip((int)rowsPerPage * _logicalPageNumber).Take<EmploymentSeriesError>((int)rowsPerPage).ToList();
            if (myPageData.Count() <= 0)
                return false;

            _logicalPageNumber++;
            xamDataGrid.DataSource = null;
            xamDataGrid.DataSource = myPageData;
            xamDataGrid.BringDataItemIntoView(myPageData.ElementAt(0), false);
            this.Measure(printableSize);
            this.Arrange(new Rect(printableSize));
            return true;
        }

        public bool MoveToPosition(PagePosition pagePosition)
        {
            _logicalPageNumber = _reportSettings.PageRange.PageFrom;
            IEnumerable<EmploymentSeriesError> myPageData = myDataSource.Skip((int)rowsPerPage * (_logicalPageNumber - 1)).Take<EmploymentSeriesError>((int)rowsPerPage).ToList();
            if (myPageData.Count() <= 0)
                return false;

            xamDataGrid.DataSource = null;
            xamDataGrid.DataSource = myPageData;
            xamDataGrid.BringDataItemIntoView(myPageData.ElementAt(0), false);
            this.Measure(printableSize);
            this.Arrange(new Rect(printableSize));
            return true;
        }

 When I try to print a single page from the middle of the document, MoveToPosition is called first, as I would expect, followed by MoveToNextPage. However, the page that I set up for rendering in MoToPosition does not appear in the final print, which is to XPS. What am I missing? Printing the full document works fine.

Parents
No Data
Reply
  • 4850
    Offline posted

    One thing to keep in mind is that during a print operation everything needs to be done synchronously. Calling UpdateLayout() on the grid might be something to try.

Children
No Data