How to: Determine the Page Number of a Clicked Page

View Example:

This example shows how to determine what page was clicked in a document using the PdfViewerControl.HitTest method of the PdfViewerControl.

using DevExpress.Xpf.PdfViewer;
using System.Windows;
using System.Windows.Input;

namespace DeterminePageNumber {

    public partial class MainWindow : Window {

        public MainWindow() {

        private void pdfViewer_MouseDown(object sender, MouseButtonEventArgs e) {
            PdfHitTestResult result = pdfViewer.HitTest(e.GetPosition(pdfViewer));
            MessageBox.Show(string.Format("You clicked on page {0}", result.DocumentPosition.PageNumber));