views:

19

answers:

2

Hi,

FlowDocumentReader doesn't have a GoToPage method, but it supports NavigationCommands.GoToPage RoutedUICommand.

How do I send NavigationCommands.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...

A: 
FlowDocumentReader flowDoc;
...
NavigationCommands.GoToPage.Execute("my parameter", flowDoc);
John Bowen
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...
Yariv
A: 

apply the command on the document. This worked for me!

Bernhard Pichler