private void viewer_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.F3) { TextSearchParameter parameters = new TextSearchParameter { IsCaseSensitive = true, WholeWord = true, Text = "Viewer" }; viewer.FindText(parameters); } }
public PDFViewer(string path, int pageID, string keyWord) { InitializeComponent(); TextSearchParameter tsp = new TextSearchParameter(); tsp.Text = keyWord; tsp.CurrentPage = pageID; pdfControl.OpenDocument(path); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Background, new System.Action(() => pdfControl.CurrentPageNumber = pageID)); //Thread.Sleep(1000); Application.Current.Dispatcher.BeginInvoke( System.Windows.Threading.DispatcherPriority.Background, new System.Action(() => pdfControl.FindText(tsp))); }