@@ -64,9 +64,8 @@ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& findTerm)
64
64
wil::com_ptr<ICoreWebView2Find> webView2Find;
65
65
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
66
66
67
- // Assuming you want to use the default UI, adjust as necessary.
68
- CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog(false));
69
- CHECK_FAILURE(webView2Find->put_ShouldHighlightAllMatches(true));
67
+ // By default Find will use the default UI and highlight all matches. If you want different behavior
68
+ // you can change the SuppressDefaultDialog and ShouldHighlightAllMatches properties here.
70
69
71
70
// Start the find operation with a callback for completion.
72
71
CHECK_FAILURE(webView2Find->StartFind(
@@ -110,7 +109,6 @@ bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& findTerm)
110
109
111
110
// Opt for using a custom UI for the find operation.
112
111
CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog(true));
113
- CHECK_FAILURE(webView2find->put_ShouldHighlightAllMatches(true));
114
112
115
113
// Start the find operation with callback for completion.
116
114
CHECK_FAILURE(webView2Find->StartFind(
@@ -161,9 +159,8 @@ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string findTerm)
161
159
FindDirection = CoreWebView2FindDirection.Forward
162
160
};
163
161
164
- // Use the default UI provided by WebView2 for the find operation.
165
- webView.CoreWebView2.FindController.SuppressDefaultDialog = false;
166
- webView.CoreWebView2.FindController.ShouldHighlightAllMatches = true;
162
+ // By default Find will use the default UI and highlight all matches. If you want different behavior
163
+ // you can change the SuppressDefaultDialog and ShouldHighlightAllMatches properties here.
167
164
168
165
// Start the find operation with the specified configuration.
169
166
await webView.CoreWebView2.FindController.StartFindAsync(findConfiguration);
0 commit comments