WPF FixedDocument pagination

Как заставить FixedDocument автоматически разбивать на страницы? У меня есть следующий код, который я могу использовать для помещения предварительно настроенной панели в DocViewer. Проблема возникает, когда панель выходит за пределы одной страницы. Прямо сейчас мы просто обрезаем. По сути, я хочу создать довольно общий способ распечатать то, что просматривает пользователь. Разумен ли мой подход?

    public void CreateReport(Panel details)
    {
        FixedDocument fixedDoc = new FixedDocument();
        PageContent pageContent = new PageContent();
        FixedPage fixedPage = new FixedPage();

        fixedPage.DataContext = this.DataContext;
        fixedPage.Margin = new Thickness(10);

        fixedPage.Children.Add(details);
        ((System.Windows.Markup.IAddChild)pageContent).AddChild(fixedPage);
        fixedDoc.Pages.Add(pageContent);

        // This makes the array of controls invisibile, then climbs the details structure
        // and makes the controls within details appropriate for the DocumentViewwer (i.e. TextBoxes are
        // non-editable, no borders, no scroll bars, etc).
        prePrintPrepare(details, fixedPage, new FrameworkElement[] { controlToMakeInvisible });

        _dv = new DocViewer();
        _dv.documentViewer1.Document = fixedDoc;
        _dv.Show();
    }
7
задан Doo Dah 24 February 2011 в 16:59
поделиться