-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathFindOnPage.md
611 lines (483 loc) · 26.7 KB
/
FindOnPage.md
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
# WebView2Find API
## Background
The WebView2Find API offers methods and events for text finding and navigation
within a WebView2 control. It enables developers to programmatically initiate Find
operations, navigate Find results, suppress default UI, and customize Find options
like find query. It also tracks the status of operations, indicating
completion, match count changes, and match index changes.
## Examples
### Default UI:
#### Without filter options
![image](https://github.com/user-attachments/assets/a71ba66b-8402-4e9d-a2fa-9437fce4a118)
#### With filter options
![image](https://github.com/user-attachments/assets/9817353b-e758-4b55-8c13-81fd036ec22a)
#### Description
To initiate a Find operation in a WebView2 control, use the `StartAsync` method.
This method allows setting the Find term and Find parameters via the
`ICoreWebView2FindOptions` interface. Only one Find session can be active per
WebView2 environment.
### Create/Specify a Find Option
#### WIN32 C++
```cpp
wil::com_ptr<ICoreWebView2FindOptions> AppWindow::InitializeFindOptions(const std::wstring& findTerm)
{
// Query for the ICoreWebView2Environment5 interface.
auto webView2Environment5 = m_webViewEnvironment.try_query<ICoreWebView2Environment5>();
CHECK_FEATURE_RETURN(webView2Environment5);
// Initialize Find options
wil::com_ptr<ICoreWebView2FindOptions> find_options;
CHECK_FAILURE(webView2Environment5->CreateFindOptions(&find_options));
CHECK_FAILURE(find_options->put_FindTerm(findTerm.c_str()));
return find_options;
}
```
```cpp
bool AppWindow::ConfigureAndExecuteFind(const std::wstring& findTerm)
{
auto find_options = InitializeFindOptions(findTerm);
if (!find_options)
{
return false;
}
// Query for the ICoreWebView2_17 interface to access the Find feature.
auto webView2_17 = m_webView.try_query<ICoreWebView2_17>();
CHECK_FEATURE_RETURN(webView2_17);
// Get the Find interface.
wil::com_ptr<ICoreWebView2Find> webView2Find;
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
// By default Find will use the default UI and highlight all matches. If you want different behavior
// you can change the SuppressDefaultDialog and ShouldHighlightAllMatches properties here.
// Start the Find operation with a callback for completion.
CHECK_FAILURE(webView2Find->StartFind(
find_options.get(),
Callback<ICoreWebView2FindOperationCompletedHandler>(
[this](HRESULT result, BOOL status) -> HRESULT
{
if (SUCCEEDED(result))
{
// Optionally update UI elements here upon successful Find operation.
}
else
{
// Handle errors.
}
return S_OK;
}).Get()));
// End user interaction is handled via UI.
return true;
}
```
```cpp
bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& findTerm)
{
auto find_options = InitializeFindOptions(findTerm);
if (!find_options)
{
return false;
}
// Query for the ICoreWebView2_17 interface to access the Find feature.
auto webView2_17 = m_webView.try_query<ICoreWebView2_17>();
CHECK_FEATURE_RETURN(webView2_17);
// Get the Find interface.
wil::com_ptr<ICoreWebView2Find> webView2Find;
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
// Opt for using a custom UI for the Find operation.
CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog(true));
// Start the Find operation with callback for completion.
CHECK_FAILURE(webView2Find->StartFind(
find_options.get(),
Callback<ICoreWebView2FindOperationCompletedHandler>(
[this](HRESULT result, BOOL status) -> HRESULT
{
if (SUCCEEDED(result) && status)
{
// Optionally update UI elements here upon successful Find operation.
}
else
{
// Handle errors or unsuccessful Find.
}
return S_OK;
}).Get()));
// Note: In this example, navigation through Find results (FindNext/FindPrevious)
// and stopping the Find operation (StopFind) are assumed to be handled by
// custom UI elements and user interaction, not directly in code here.
// User could then connect functions such as FindNext, FindPrevious, and StopFind
// to corresponding custom UI elements.
return true;
}
```
#### .NET C#
```csharp
async Task ConfigureAndExecuteFindWithDefaultUIAsync(string findTerm)
{
try
{
// Check if the webView is already initialized and is an instance of CoreWebView2.
if (webView.CoreWebView2 == null)
{
throw new InvalidOperationException("WebView2 is not initialized.");
}
// Initialize the Find options with specified settings.
var find_options = new CoreWebView2FindOptions
{
FindTerm = findTerm
};
// By default Find will use the default UI and highlight all matches. If you want different behavior
// you can change the SuppressDefaultDialog and ShouldHighlightAllMatches properties here.
// Start the Find operation with the specified options.
await webView.CoreWebView2.Find.StartAsync(find_options);
// End user interaction is handled via UI.
}
catch (Exception ex)
{
// Handle any errors that may occur during the Find operation.
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
```
```csharp
async Task ConfigureAndExecuteFindWithCustomUIAsync(string findTerm)
{
try
{
// Check if the webView is already initialized and is an instance of CoreWebView2.
if (webView.CoreWebView2 == null)
{
throw new InvalidOperationException("WebView2 is not initialized.");
}
// Initialize the Find options.
var find_options = new CoreWebView2FindOptions
{
FindTerm = findTerm
};
// Specify that a custom UI will be used for the Find operation.
webView.CoreWebView2.Find.SuppressDefaultDialog = true;
webView.CoreWebView2.Find.ShouldHighlightAllMatches = true;
// Start the Find operation with the specified options.
await webView.CoreWebView2.Find.StartAsync(find_options);
// It's expected that the custom UI for navigating between matches (next, previous)
// and stopping the Find operation will be managed by the developer's custom code.
}
catch (Exception ex)
{
// Handle any errors that may occur during the Find operation.
Console.WriteLine($"An error occurred: {ex.Message}");
}
}
```
### Retrieve the Index of the Active Match
#### Description
Developers can retrieve the index of the currently active match
within a WebView2 control using the `ActiveMatchIndex` property.
```cpp
bool AppWindow::GetActiveMatchIndex()
{
auto webView2_17 = m_webView.try_query<ICoreWebView2_17>();
CHECK_FEATURE_RETURN(webView2_17);
wil::com_ptr<ICoreWebView2Find> webView2Find;
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
LONG activeMatchIndex;
CHECK_FAILURE(webView2Find->get_ActiveMatchIndex(&activeMatchIndex));
// Update UI or handle activeMatchIndex as you wish
// For example, you could show a message box
std::wstring activeMatchIndexStr =
L"Active Match Index: " + std::to_wstring(activeMatchIndex);
MessageBox(m_mainWindow, activeMatchIndexStr.c_str(), L"Find Operation", MB_OK);
return true;
}
// Register ActiveMatchIndexChanged event handler
m_webView->add_ActiveMatchIndexChanged(
Callback<ICoreWebView2FindActiveMatchIndexChangedEventHandler>(
[this](LONG activeMatchIndex) -> HRESULT
{
// Update custom UI
wprintf(L"Active Match Index Changed: %ld\n", activeMatchIndex);
return S_OK;
}).Get(),
&m_activeMatchIndexChangedToken);
```
#### .NET C#
```csharp
public Task<int> GetActiveMatchIndex()
{
var webViewFind = webView.CoreWebView2.Find; // Assuming webView is your WebView2 control
var activeMatchIndex = webViewFind.ActiveMatchIndex();
MessageBox.Show($"Active Match Index: {activeMatchIndex}", "Find Operation", MessageBoxButton.OK);
return activeMatchIndex;
}
void ActiveMatchIndexChangedSample()
{
webView.CoreWebView2.Find.ActiveMatchIndexChanged += (object sender, EventArgs args) =>
{
int activeMatchIndex = webView.CoreWebView2.Find.ActiveMatchIndex;
// Update Custom UI based on the new active match index.
};
}
```
## API Details
```cpp
/// Interface that provides methods related to the environment settings of CoreWebView2.
/// This interface allows for the creation of new Find options objects.
// MSOWNERS: core ([email protected])
[uuid(f10bddd3-bb59-5d5b-8748-8a1a53f65d0c), object, pointer_default(unique)]
interface ICoreWebView2Environment5 : IUnknown {
/// Creates a new instance of a FindOptions object.
/// This options object can be used to define parameters for a Find operation.
/// Returns the newly created FindOptions object.
// MSOWNERS: core ([email protected])
HRESULT CreateFindOptions(
[out, retval] ICoreWebView2FindOptions** value
);
}
/// Receives the result of the `StartFind` method.
[uuid(7c20f8b0-c14e-5135-a099-6c9d11d59dd1), object, pointer_default(unique)]
interface ICoreWebView2indStartFindCompletedHandler : IUnknown {
/// Provides the result of the corresponding asynchronous method.
HRESULT Invoke([in] HRESULT errorCode);
}
/// Receives `FindActiveMatchIndexChanged` events.
[uuid(8d3422bf-66df-5bae-9916-71fd23d5bef6), object, pointer_default(unique)]
interface ICoreWebView2FindActiveMatchIndexChangedEventHandler : IUnknown {
/// Provides the event args for the corresponding event.
HRESULT Invoke(
[in] ICoreWebView2Find* sender,
[in] IUnknown* args);
}
/// Receives `FindMatchCountChanged` events.
[uuid(cecb8e8f-b6c8-55c3-98b1-68fd1e2b9eea), object, pointer_default(unique)]
interface ICoreWebView2FindMatchCountChangedEventHandler : IUnknown {
/// Provides the event args for the corresponding event.
HRESULT Invoke(
[in] ICoreWebView2Find* sender,
[in] IUnknown* args);
}
/// Interface providing methods and properties for finding and navigating through text in the WebView2.
/// This interface allows for finding text, navigation between matches, and customization of the Find UI.
// MSOWNERS: core ([email protected])
[uuid(9c494a0a-c5d8-5fee-b7e6-4926d8d7b391), object, pointer_default(unique)]
interface ICoreWebView2Find : IUnknown {
/// Retrieves the index of the currently active match in the Find session. Returns the index of the currently active match, or -1 if there is no active match.
// MSOWNERS: core ([email protected])
[propget] HRESULT ActiveMatchIndex([out, retval] UINT32* value);
/// Gets the total count of matches found in the current document based on the last Find sessions criteria. Returns the total count of matches.
// MSOWNERS: core ([email protected])
[propget] HRESULT MatchCount([out, retval] UINT32* value);
/// Gets the `ShouldHighlightAllMatches` property.
// MSOWNERS: core ([email protected])
[propget] HRESULT ShouldHighlightAllMatches([out, retval] BOOL* value);
/// Gets or sets the state of whether all matches are highlighted. Returns TRUE if all matches are highlighted, FALSE otherwise.
// MSOWNERS: core ([email protected])
[propput] HRESULT ShouldHighlightAllMatches([in] BOOL value);
/// Gets the `SuppressDefaultFindDialog` property.
// MSOWNERS: core ([email protected])
[propget] HRESULT SuppressDefaultFindDialog([out, retval] BOOL* value);
/// Checks if a custom user interface is desired by the end developer. Returns TRUE if using a custom UI, FALSE if using the default.
// MSOWNERS: core ([email protected])
[propput] HRESULT SuppressDefaultFindDialog([in] BOOL value);
/// Adds an event handler for the `ActiveMatchIndexChanged` event.
/// Registers an event handler for the ActiveMatchIndexChanged event. This event is raised when the index of the currently active match changes. This can happen when the user navigates to a different match or when the active match is changed programmatically. The parameter is the event handler to be added. Returns a token representing the added event handler. This token can be used to unregister the event handler.
// MSOWNERS: core ([email protected])
HRESULT add_ActiveMatchIndexChanged(
[in] ICoreWebView2ActiveMatchIndexChangedEventHandler* eventHandler,
[out] EventRegistrationToken* token);
/// Removes an event handler previously added with `add_ActiveMatchIndexChanged`.
// MSOWNERS: core ([email protected])
HRESULT remove_ActiveMatchIndexChanged(
[in] EventRegistrationToken token);
/// Adds an event handler for the `MatchCountChanged` event.
/// Registers an event handler for the MatchCountChanged event. This event is raised when the total count of matches in the document changes due to a new Find operation or changes in the document. /// The parameter is the event handler to be added. Returns a token representing the added event handler. This token can be used to unregister the event handler.
// MSOWNERS: core ([email protected])
HRESULT add_MatchCountChanged(
[in] ICoreWebView2MatchCountChangedEventHandler* eventHandler,
[out] EventRegistrationToken* token);
/// Removes an event handler previously added with `add_MatchCountChanged`.
// MSOWNERS: core ([email protected])
HRESULT remove_MatchCountChanged(
[in] EventRegistrationToken token);
/// Initiates a Find using the specified Find option.
/// Displays the Find bar and starts the Find operation. If a Find session was already ongoing, it will be stopped and replaced with this new instance.
/// If called with an empty string, the Find bar is displayed but no finding occurs. Changing the Find options object after initiation won't affect the ongoing Find session.
/// To change the ongoing Find session, Start must be called again with a new or modified Find options object.
/// This method is primarily designed for HTML document queries.
// MSOWNERS: core ([email protected])
HRESULT StartFind(
[in] ICoreWebView2FindOptions* options
, [in] ICoreWebView2FindStartFindCompletedHandler* handler
);
/// Navigates to the next match in the document.
// MSOWNERS: core ([email protected])
HRESULT FindNext(
);
/// Navigates to the previous match in the document.
// MSOWNERS: core ([email protected])
HRESULT FindPrevious(
);
/// Stops the current 'Find' operation and hides the Find bar.
// MSOWNERS: core ([email protected])
HRESULT StopFind(
);
}
/// Interface defining the Find options.
/// This interface provides the necessary methods and properties to configure a Find operation.
// MSOWNERS: core ([email protected])
[uuid(52a04b23-acc8-5659-aa2f-26dbe9faafde), object, pointer_default(unique)]
interface ICoreWebView2FindOptions : IUnknown {
/// Gets the `FindTerm` property.
///
/// The caller must free the returned string with `CoTaskMemFree`. See
/// [API Conventions](/microsoft-edge/webview2/concepts/win32-api-conventions#strings).
// MSOWNERS: core ([email protected])
[propget] HRESULT FindTerm([out, retval] LPWSTR* value);
///
// MSOWNERS: core ([email protected])
[propput] HRESULT FindTerm([in] LPCWSTR value);
/// Gets the `IsCaseSensitive` property.
// MSOWNERS: core ([email protected])
[propget] HRESULT IsCaseSensitive([out, retval] BOOL* value);
///
// MSOWNERS: core ([email protected])
[propput] HRESULT IsCaseSensitive([in] BOOL value);
/// Gets the `ShouldMatchWord` property.
// MSOWNERS: core ([email protected])
[propget] HRESULT ShouldMatchWord([out, retval] BOOL* value);
///
// MSOWNERS: core ([email protected])
[propput] HRESULT ShouldMatchWord([in] BOOL value);
}
///
/// Interface providing methods to access the Find operation functionalities in the CoreWebView2.
///
// MSOWNERS: core ([email protected])
[uuid(c9a130ca-a807-549c-9d76-8e09ccee3973), object, pointer_default(unique)]
interface ICoreWebView2_17 : IUnknown {
/// Retrieves the Find operation interface for the current WebView2.
// MSOWNERS: core ([email protected])
[propget] HRESULT Find([out, retval] ICoreWebView2Find** value);
}
```
### Setting Up Find Options with MIDL3
### CoreWebView2 Find Configuration
### CoreWebView2 Find Interface
```csharp
namespace Microsoft.Web.WebView2.Core
{
/// <com>
/// Interface providing methods to access the Find operation functionalities in the CoreWebView2.
/// </com>
[com_interface("staging=ICoreWebView2_17")]
[ms_owner("core", "[email protected]")]
interface ICoreWebView2_25
{
/// Retrieves the Find operation interface for the current WebView2.
CoreWebView2Find Find { get; };
}
/// Interface that provides methods related to the environment settings of CoreWebView2.
/// This interface allows for the creation of new Find options objects.
[com_interface("staging=ICoreWebView2Environment5")]
[ms_owner("core", "[email protected]")]
interface ICoreWebView2Environment15
{
/// Creates a new instance of a CoreWebView2FindOptions object.
/// This Find options object can be used to define parameters for a Find operation.
/// Returns the newly created FindOptions object.
CoreWebView2FindOptions CreateFindOptions();
};
runtimeclass CoreWebView2FindOptions : [default]ICoreWebView2FindOptions {}
/// Interface defining the find options.
/// This interface provides the necessary methods and properties to configure a find session.
[com_interface("experimental=ICoreWebView2ExperimentalFindOptions")]
[ms_owner("core", "[email protected]")]
[availability("experimental")]
interface ICoreWebView2FindOptions
{
/// Gets or sets the word or phrase to be searched in the current page.
/// You can set `FindTerm` to any text you want to find on the page.
/// This will take effect the next time you call the `StartAsync()` method.
String FindTerm { get; set; };
/// Determines if the find session is case sensitive. Returns TRUE if the find is case sensitive, FALSE otherwise.
/// When toggling case sensitivity, the behavior can vary by locale, which may be influenced by both the browser's UI locale and the document's language settings. The browser's UI locale
/// typically provides a default handling approach, while the document's language settings (e.g., specified using the HTML lang attribute) can override these defaults to apply locale-specific rules. This dual consideration
/// ensures that text is processed in a manner consistent with user expectations and the linguistic context of the content.
Boolean IsCaseSensitive { get; set; };
/// Similar to case sensitivity, word matching also can vary by locale, which may be influenced by both the browser's UI locale and the document's language settings. The browser's UI locale
/// typically provides a default handling approach, while the document's language settings (e.g., specified using the HTML lang attribute) can override these defaults to apply locale-specific rules. This dual consideration
/// ensures that text is processed in a manner consistent with user expectations and the linguistic context of the content.
/// ShouldMatchWord determines if only whole words should be matched during the find session. Returns TRUE if only whole words should be matched, FALSE otherwise.
Boolean ShouldMatchWord { get; set; };
/// Gets or sets the state of whether all matches are highlighted.
/// Returns TRUE if all matches are highlighted, FALSE otherwise.
/// Note: Changes to this property take effect only when StartAsync, FindNext, or FindPrevious is called.
/// Preferences for the session cannot be updated unless another call to the StartAsync function on the server-side is made.
/// Therefore, changes will not take effect until one of these functions is called.
Boolean ShouldHighlightAllMatches { get; set; };
/// Sets this property to hide the default Find UI.
/// You can use this to hide the default UI so that you can show your own custom UI or programmatically interact with the Find API while showing no Find UI.
/// Returns TRUE if hiding the default Find UI and FALSE if using showing the default Find UI.
/// Note: Changes to this property take effect only when StartAsync, FindNext, or FindPrevious is called.
/// Preferences for the session cannot be updated unless another call to the StartAsync function on the server-side is made.
/// Therefore, changes will not take effect until one of these functions is called.
Boolean SuppressDefaultFindDialog { get; set; };
};
runtimeclass CoreWebView2Find : [default]ICoreWebView2Find {}
/// Interface providing methods and properties for finding and navigating through text in the web view.
/// This interface allows for finding text, navigation between matches, and customization of the find UI.
[com_interface("experimental=ICoreWebView2ExperimentalFind")]
[ms_owner("core", "[email protected]")]
[availability("experimental")]
interface ICoreWebView2Find
{
/// Initiates a find using the specified find options asynchronously.
/// Displays the Find bar and starts the find session. If a find session was already ongoing, it will be stopped and replaced with this new instance.
/// If called with an empty string, the Find bar is displayed but no finding occurs. Changing the FindOptions object after initiation won't affect the ongoing find session.
/// To change the ongoing find session, StartAsync must be called again with a new or modified FindOptions object.
/// StartAsync supports HTML and TXT document queries. In general, this API is designed for text-based find sessions.
/// If you start a find session programmatically on another file format that doesn't have text fields, the find session will try to execute but will fail to find any matches. (It will silently fail)
/// Note: The asynchronous action completes when the UI has been displayed with the find term in the UI bar, and the matches have populated on the counter on the find bar.
/// There may be a slight latency between the UI display and the matches populating in the counter.
/// The MatchCountChanged and ActiveMatchIndexChanged events are only raised after StartAsync has completed; otherwise, they will have their default values (-1 for active match index and 0 for match count).
/// To start a new find session (beginning the search from the first match), call `Stop` before invoking `StartAsync`.
/// If `StartAsync` is called consecutively with the same options and without calling `Stop`, the find session
/// will continue from the current position in the existing session.
/// Calling `StartAsync` without altering its parameters will behave either as `FindNext` or `FindPrevious`, depending on the most recent search action performed.
/// StartAsync will default to forward if neither have been called.
/// However, calling Start again during an ongoing find session does not resume from the point
/// of the current active match. For example, given the text "1 1 A 1 1" and initiating a find session for "A",
/// then starting another find session for "1", it will start searching from the beginning of the document,
/// regardless of the previous active match. This behavior indicates that changing the find query initiates a
/// completely new find session, rather than continuing from the previous match index.
Windows.Foundation.IAsyncAction StartAsync(CoreWebView2FindOptions options);
/// Navigates to the next match in the document.
/// If there are no matches to find, FindNext will wrap around to the first match's index.
/// If called when there is no find session active, FindPrevious will silently fail.
void FindNext();
/// Navigates to the previous match in the document.
/// If there are no matches to find, FindPrevious will wrap around to the last match's index.
/// If called when there is no find session active, FindPrevious will silently fail.
void FindPrevious();
/// Stops the current 'Find' session and hides the Find bar.
/// If called with no Find session active, it will silently do nothing.
void Stop();
/// Retrieves the index of the currently active match in the find session. Returns the index of the currently active match, or -1 if there is no active match.
/// The index starts at 1 for the first match.
Int32 ActiveMatchIndex { get; };
/// Gets the total count of matches found in the current document based on the last find sessions criteria. Returns the total count of matches.
Int32 MatchCount { get; };
/// Registers an event handler for the MatchCountChanged event.
/// This event is raised when the total count of matches in the document changes due to a new find session or changes in the document.
/// The parameter is the event handler to be added. Returns a token representing the added event handler. This token can be used to unregister the event handler.
event Windows.Foundation.TypedEventHandler<CoreWebView2Find, Object> MatchCountChanged;
/// Registers an event handler for the ActiveMatchIndexChanged event. This event is raised when the index of the currently active match changes.
/// This can happen when the user navigates to a different match or when the active match is changed programmatically.
/// The parameter is the event handler to be added. Returns a token representing the added event handler.
/// This token can be used to unregister the event handler.
event Windows.Foundation.TypedEventHandler<CoreWebView2Find, Object> ActiveMatchIndexChanged;
};
}
}
```
# Appendix
This API specification focuses on providing developers with the necessary information
to integrate text finding and navigation functionalities into WebView2 applications.
It emphasizes the usage of interfaces such as `ICoreWebView2Find` and
`ICoreWebView2FindOptions` to perform Find operations effectively.