5
5
The WebView2Find API offers methods and events for text finding and navigation
6
6
within a WebView2 control. It enables developers to programmatically initiate find
7
7
operations, navigate find results, suppress default UI, and customize find configurations
8
- like query and search direction. It also tracks the status of operations, indicating
8
+ like query and find direction. It also tracks the status of operations, indicating
9
9
completion, match count changes, and match index changes.
10
10
11
11
## Examples
@@ -14,7 +14,7 @@ completion, match count changes, and match index changes.
14
14
#### Description
15
15
16
16
To initiate a find operation in a WebView2 control, use the ` StartFind ` method.
17
- This method allows setting the search term and find parameters via the
17
+ This method allows setting the find term and find parameters via the
18
18
` ICoreWebView2FindConfiguration ` interface. Only one find session can be active per
19
19
webview environment. Starting another with the same configuration will adjust
20
20
the active match index based on the selected Find Direction.
@@ -24,7 +24,7 @@ the active match index based on the selected Find Direction.
24
24
``` cpp
25
25
26
26
// ! [InitializeFindConfiguration]
27
- wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfiguration (const std::wstring& searchTerm )
27
+ wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfiguration (const std::wstring& findTerm )
28
28
{
29
29
// Query for the ICoreWebView2Environment5 interface.
30
30
auto webView2Environment5 = m_webViewEnvironment.try_query<ICoreWebView2Environment5 >();
@@ -33,7 +33,7 @@ wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfigurat
33
33
// Initialize find configuration/settings
34
34
wil::com_ptr<ICoreWebView2FindConfiguration> findConfiguration;
35
35
CHECK_FAILURE(webView2Environment5->CreateFindConfiguration(&findConfiguration));
36
- CHECK_FAILURE(findConfiguration->put_FindTerm(searchTerm .c_str()));
36
+ CHECK_FAILURE(findConfiguration->put_FindTerm(findTerm .c_str()));
37
37
CHECK_FAILURE(findConfiguration->put_IsCaseSensitive(false));
38
38
CHECK_FAILURE(findConfiguration->put_ShouldMatchWord(false));
39
39
CHECK_FAILURE(findConfiguration->put_FindDirection(COREWEBVIEW2_FIND_DIRECTION_FORWARD));
@@ -49,9 +49,9 @@ wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfigurat
49
49
50
50
```cpp
51
51
//! [ExecuteFindWithDefaultUI]
52
- bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm )
52
+ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& findTerm )
53
53
{
54
- auto findConfiguration = InitializeFindConfiguration(searchTerm );
54
+ auto findConfiguration = InitializeFindConfiguration(findTerm );
55
55
if (!findConfiguration)
56
56
{
57
57
return false;
@@ -93,9 +93,9 @@ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
93
93
94
94
``` cpp
95
95
// ! [ExecuteFindWithCustomUI]
96
- bool AppWindow::ExecuteFindWithCustomUI (const std::wstring& searchTerm )
96
+ bool AppWindow::ExecuteFindWithCustomUI (const std::wstring& findTerm )
97
97
{
98
- auto findConfiguration = InitializeFindConfiguration(searchTerm );
98
+ auto findConfiguration = InitializeFindConfiguration(findTerm );
99
99
if (!findConfiguration)
100
100
{
101
101
return false;
@@ -124,7 +124,7 @@ bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& searchTerm)
124
124
}
125
125
else
126
126
{
127
- // Handle errors or unsuccessful search .
127
+ // Handle errors or unsuccessful find .
128
128
}
129
129
return S_OK;
130
130
}).Get()));
@@ -142,7 +142,7 @@ bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& searchTerm)
142
142
#### .NET C#
143
143
```csharp
144
144
//! [ConfigureAndExecuteFindWithDefaultUI]
145
- async Task ConfigureAndExecuteFindWithDefaultUIAsync(string searchTerm )
145
+ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string findTerm )
146
146
{
147
147
try
148
148
{
@@ -155,7 +155,7 @@ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string searchTerm)
155
155
// Initialize the find configuration with specified settings.
156
156
var findConfiguration = new CoreWebView2FindConfiguration
157
157
{
158
- FindTerm = searchTerm ,
158
+ FindTerm = findTerm ,
159
159
IsCaseSensitive = false,
160
160
ShouldMatchWord = false,
161
161
FindDirection = CoreWebView2FindDirection.Forward
@@ -181,7 +181,7 @@ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string searchTerm)
181
181
182
182
``` csharp
183
183
// ! [ConfigureAndExecuteFindWithCustomUI]
184
- async Task ConfigureAndExecuteFindWithCustomUIAsync (string searchTerm )
184
+ async Task ConfigureAndExecuteFindWithCustomUIAsync (string findTerm )
185
185
{
186
186
try
187
187
{
@@ -194,7 +194,7 @@ async Task ConfigureAndExecuteFindWithCustomUIAsync(string searchTerm)
194
194
// Initialize the find configuration with specified settings.
195
195
var findConfiguration = new CoreWebView2FindConfiguration
196
196
{
197
- FindTerm = searchTerm ,
197
+ FindTerm = findTerm ,
198
198
IsCaseSensitive = false ,
199
199
ShouldMatchWord = false ,
200
200
FindDirection = CoreWebView2FindDirection .Forward
@@ -282,13 +282,13 @@ void ActiveMatchIndexChangedSample()
282
282
## API Details
283
283
``` cpp
284
284
285
- // / Specifies the direction of Search Parameters.
285
+ // / Specifies the direction of find Parameters.
286
286
// MSOWNERS: core ([email protected] )
287
287
[v1_enum]
288
288
typedef enum COREWEBVIEW2_FIND_DIRECTION {
289
- /// Specifies a forward search in the document.
289
+ /// Specifies a forward find in the document.
290
290
COREWEBVIEW2_FIND_DIRECTION_FORWARD,
291
- /// Specifies a backwards search in the document.
291
+ /// Specifies a backwards find in the document.
292
292
COREWEBVIEW2_FIND_DIRECTION_BACKWARD,
293
293
} COREWEBVIEW2_FIND_DIRECTION;
294
294
@@ -299,7 +299,7 @@ typedef enum COREWEBVIEW2_FIND_DIRECTION {
299
299
[uuid(f10bddd3-bb59-5d5b-8748 -8a1a53f65d0c), object, pointer_default(unique)]
300
300
interface ICoreWebView2StagingEnvironment5 : IUnknown {
301
301
/// Creates a new instance of a FindConfiguration object.
302
- /// This configuration object can be used to define parameters for a search operation.
302
+ /// This configuration object can be used to define parameters for a find operation.
303
303
/// Returns the newly created FindConfiguration object.
304
304
// MSOWNERS: core (
[email protected] )
305
305
HRESULT CreateFindConfiguration(
@@ -429,7 +429,7 @@ interface ICoreWebView2StagingFind : IUnknown {
429
429
430
430
431
431
// / Interface defining the find configuration.
432
- // / This interface provides the necessary methods and properties to configure a search operation.
432
+ // / This interface provides the necessary methods and properties to configure a find operation.
433
433
// MSOWNERS: core ([email protected] )
434
434
[uuid(52a04b23-acc8-5659 -aa2f-26dbe9faafde), object, pointer_default(unique)]
435
435
interface ICoreWebView2StagingFindConfiguration : IUnknown {
@@ -523,31 +523,31 @@ namespace Microsoft.Web.WebView2.Core
523
523
``` csharp
524
524
namespace Microsoft .Web .WebView2 .Core
525
525
{
526
- /// Specifies the direction of Search Parameters.
526
+ /// Specifies the direction of find Parameters.
527
527
[
ms_owner (
" core" ,
" [email protected] " )]
528
528
[availability (" staging" )]
529
529
enum CoreWebView2FindDirection
530
530
{
531
- /// Specifies a forward search in the document.
531
+ /// Specifies a forward find in the document.
532
532
Forward ,
533
- /// Specifies a backwards search in the document.
533
+ /// Specifies a backwards find in the document.
534
534
Backward ,
535
535
};
536
536
537
537
runtimeclass CoreWebView2FindConfiguration : [default ]ICoreWebView2FindConfiguration {}
538
538
539
539
/// Interface defining the find configuration.
540
- /// This interface provides the necessary methods and properties to configure a search operation.
540
+ /// This interface provides the necessary methods and properties to configure a find operation.
541
541
[com_interface (" staging=ICoreWebView2StagingFindConfiguration" )]
542
542
[
ms_owner (
" core" ,
" [email protected] " )]
543
543
[availability (" staging" )]
544
544
interface ICoreWebView2FindConfiguration
545
545
{
546
- // Gets or sets the search term used for the find operation. Returns the search term.
546
+ // Gets or sets the find term used for the find operation. Returns the find term.
547
547
String FindTerm { get ; set ; };
548
- // Gets or sets the direction of the search operation (forward or backward). Returns the search direction.
548
+ // Gets or sets the direction of the find operation (forward or backward). Returns the find direction.
549
549
CoreWebView2FindDirection FindDirection { get ; set ; };
550
- // Determines if the search operation is case sensitive. Returns TRUE if the search is case sensitive, FALSE otherwise.
550
+ // Determines if the find operation is case sensitive. Returns TRUE if the find is case sensitive, FALSE otherwise.
551
551
Boolean IsCaseSensitive { get ; set ; };
552
552
// Determines if only whole words should be matched during the find operation. Returns TRUE if only whole words should be matched, FALSE otherwise.
553
553
Boolean ShouldMatchWord { get ; set ; };
0 commit comments