How do I send a NavigationCommand to a control?
FlowDocumentReader doesn't have a GoToPage method, but it supports NavigationCommands.GoToPage RoutedUICommand.
How do I send Navi开发者_运维问答gationCommands.GoToPage with parameter (for example: 1) to my FlowDocumentReader from within my code (not using xaml)?
Thanks, Yariv
Edited: Thanks! But though I can send the command with your help, I don't get the expected results. This is the code (and I tried to use FirstPage instead of PreviousPage too):
if (NavigationCommands.PreviousPage.CanExecute(null, this) == true)
{
NavigationCommands.PreviousPage.Execute(null, this);
}
Even though the if statement is true and the inner code is being executed, the FlowDocumentReader stays in the last page...
FlowDocumentReader flowDoc;
...
NavigationCommands.GoToPage.Execute("my parameter", flowDoc);
精彩评论