如何将NavigationCommand发送到控件?

时间:2010-09-17 11:56:36

标签: wpf flowdocumentreader

FlowDocumentReader没有GoToPage方法,但它支持NavigationCommands.GoToPage RoutedUICommand。

如何将带有参数的NavigationCommands.GoToPage(例如:1)发送到我的代码中的FlowDocumentReader (不使用xaml)?

谢谢,    Yariv

编辑: 谢谢!但是虽然我可以在你的帮助下发送命令,但我没有得到预期的结果。这是代码(我尝试使用FirstPage而不是PreviousPage):

if (NavigationCommands.PreviousPage.CanExecute(null, this) == true)
{
    NavigationCommands.PreviousPage.Execute(null, this);
}

即使if语句为true且内部代码正在执行,FlowDocumentReader也会保留在最后一页......

1 个答案:

答案 0 :(得分:0)

FlowDocumentReader flowDoc;
...
NavigationCommands.GoToPage.Execute("my parameter", flowDoc);