1

WPF DocumentViewer 有点问题。我正在使用 DocumentViewer 显示 XPS 文件。我想将 XPS 文档导航到某个页面,但在窗口初始化期间它导航到了错误的页码。

这是我的代码:

public partial class Window : Window
{
    private string _XPSpath;

    public Window()
    {
        InitializeComponent();
        _XPSPath = @"C:\TestFolder\TestDocument.xps";
        MyDocViewer.Document = new XpsDocument(_XPSpath, FileAccess.Read).GetFixedDocumentSequence();

        DocViewer.GoToPage(100); // Navigates to wrong page !!!!!!!!!            
    }

    private void GoToPageButton_Click(object sender, RoutedEventArgs e)
    {
        DocViewer.GoToPage(100); //this one is ok.
    }
}

有没有办法解决这个问题?

4

0 回答 0