View Example: https://github.com/DevExpress-Examples/how-to-determine-the-page-number-of-a-clicked-page
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() {
InitializeComponent();
pdfViewer.OpenDocument("..\\..\\demo.pdf");
}
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));
}
}
}
Imports DevExpress.Xpf.PdfViewer
Imports System.Windows
Imports System.Windows.Input
Namespace DeterminePageNumber
Partial Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
pdfViewer.OpenDocument("..\..\demo.pdf")
End Sub
Private Sub pdfViewer_MouseDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
Dim result As PdfHitTestResult = pdfViewer.HitTest(e.GetPosition(pdfViewer))
MessageBox.Show(String.Format("You clicked on page {0}", result.DocumentPosition.PageNumber))
End Sub
End Class
End Namespace
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DeterminePageNumber"
xmlns:dxpdf="http://schemas.devexpress.com/winfx/2008/xaml/pdf" x:Class="DeterminePageNumber.MainWindow"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxpdf:PdfViewerControl x:Name="pdfViewer" MouseDown="pdfViewer_MouseDown"/>
</Grid>
</Window>