Skip to content

Commit f68c12c

Browse files
authored
Update FindOnPage.md
1 parent 9c6460b commit f68c12c

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

FindOnPage.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,14 @@ wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfigurat
4242
auto webView2_17 = m_webView.try_query<ICoreWebView2_17>();
4343
CHECK_FEATURE_RETURN(webView2_17);
4444

45-
// Get the Find interface.
46-
wil::com_ptr<ICoreWebView2Find> webView2Find;
47-
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
48-
4945
return findConfiguration;
5046
}
5147
//! [InitializeFindConfiguration]
5248
```
5349
5450
```cpp
5551
//! [ExecuteFindWithDefaultUI]
56-
bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
52+
bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
5753
{
5854
auto findConfiguration = InitializeFindConfiguration(searchTerm);
5955
if (!findConfiguration)
@@ -69,7 +65,7 @@ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
6965
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
7066
7167
// Assuming you want to use the default UI, adjust as necessary.
72-
CHECK_FAILURE(webView2Find->put_UseCustomUI(false));
68+
CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog(false));
7369
CHECK_FAILURE(webView2Find->put_ShouldHighlightAllMatches(true));
7470
7571
// Start the find operation with a callback for completion.
@@ -113,7 +109,7 @@ bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& searchTerm)
113109
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
114110

115111
// Opt for using a custom UI for the find operation.
116-
CHECK_FAILURE(webView2Find->put_UseCustomUI(true));
112+
CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog(true));
117113
CHECK_FAILURE(webView2find->put_ShouldHighlightAllMatches(true));
118114

119115
// Start the find operation with callback for completion.
@@ -166,7 +162,7 @@ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string searchTerm)
166162
};
167163
168164
// Use the default UI provided by WebView2 for the find operation.
169-
webView.CoreWebView2.FindController.UseCustomUI = false;
165+
webView.CoreWebView2.FindController.SuppressDefaultDialog = false;
170166
webView.CoreWebView2.FindController.ShouldHighlightAllMatches = true;
171167
172168
// Start the find operation with the specified configuration.
@@ -205,7 +201,7 @@ async Task ConfigureAndExecuteFindWithCustomUIAsync(string searchTerm)
205201
};
206202

207203
// Specify that a custom UI will be used for the find operation.
208-
webView.CoreWebView2.FindController.UseCustomUI = true;
204+
webView.CoreWebView2.FindController.SuppressDefaultDialog = true;
209205
webView.CoreWebView2.FindController.ShouldHighlightAllMatches = true;
210206

211207
// Start the find operation with the specified configuration.

0 commit comments

Comments
 (0)