-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml.cs
41 lines (31 loc) · 1.18 KB
/
MainWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using DevExpress.Pdf;
using DevExpress.Xpf.PdfViewer;
using System.Windows;
using System.Windows.Input;
namespace DetermineContentType {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
viewer.OpenDocument("..\\..\\demo.pdf");
}
private void viewer_MouseMove(object sender, MouseEventArgs e) {
PdfHitTestResult result = viewer.HitTest(e.GetPosition(viewer));
string contentTypeText = result.IsSelected ? "Selected " : "Unselected ";
switch (result.ContentType) {
case PdfDocumentContentType.Text:
contentTypeText = contentTypeText + "Text";
break;
case PdfDocumentContentType.Image:
contentTypeText = contentTypeText + " Image";
break;
case PdfDocumentContentType.Annotation:
contentTypeText = contentTypeText + "Annotation";
break;
default:
contentTypeText = "The content is empty";
break;
}
barButtonItem.Content = contentTypeText;
}
}
}