I would like to invoke the NavigateToNextPageCommand, NavigateToPreviousPageCommand and NavigateToPageCommand commands from code behind however I am having a bit of trouble.
I have successfully invoked the NavigateToNextPageCommand using the following code :-
if (PdfViewerControl2.NavigateToNextPageCommand.CanExecute(null))
{
PdfViewerControl2.NavigateToNextPageCommand.Execute(null);
CurrentPageNumber++;
SetCanExecutes(BindingContext as SmartDocViewModel);
}
However, using a similar approach for the NavigateToPreviousPageCommand, the CanExecute method against the command returns false.
Also I am trying to invoke the NavigateToPageCommand in such a way that it acts as a beginning/end command, so I pass either 1 or the VisiblePagesCount value (last page) to the NavigateToPageCommand command however it does not change the page.
The provided sample uses the commands directly via buttons in the XAML however due to my use case I need to invoke the commands in code behind.
Would you be able to help me?