@@ -42,18 +42,14 @@ wil::com_ptr<ICoreWebView2FindConfiguration> AppWindow::InitializeFindConfigurat
42
42
auto webView2_17 = m_webView.try_query<ICoreWebView2_17>();
43
43
CHECK_FEATURE_RETURN(webView2_17);
44
44
45
- // Get the Find interface.
46
- wil::com_ptr<ICoreWebView2Find> webView2Find;
47
- CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
48
-
49
45
return findConfiguration;
50
46
}
51
47
//! [ InitializeFindConfiguration]
52
48
```
53
49
54
50
```cpp
55
51
//! [ExecuteFindWithDefaultUI]
56
- bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
52
+ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
57
53
{
58
54
auto findConfiguration = InitializeFindConfiguration(searchTerm);
59
55
if (!findConfiguration)
@@ -69,7 +65,7 @@ bool AppWindow::ConfigureAndExecuteFind(const std::wstring& searchTerm)
69
65
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
70
66
71
67
// 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));
73
69
CHECK_FAILURE(webView2Find->put_ShouldHighlightAllMatches(true));
74
70
75
71
// Start the find operation with a callback for completion.
@@ -113,7 +109,7 @@ bool AppWindow::ExecuteFindWithCustomUI(const std::wstring& searchTerm)
113
109
CHECK_FAILURE(webView2_17->get_Find(&webView2Find));
114
110
115
111
// Opt for using a custom UI for the find operation.
116
- CHECK_FAILURE(webView2Find->put_UseCustomUI (true));
112
+ CHECK_FAILURE(webView2Find->put_SuppressDefaultDialog (true));
117
113
CHECK_FAILURE(webView2find->put_ShouldHighlightAllMatches(true));
118
114
119
115
// Start the find operation with callback for completion.
@@ -166,7 +162,7 @@ async Task ConfigureAndExecuteFindWithDefaultUIAsync(string searchTerm)
166
162
};
167
163
168
164
// Use the default UI provided by WebView2 for the find operation.
169
- webView.CoreWebView2.FindController.UseCustomUI = false;
165
+ webView.CoreWebView2.FindController.SuppressDefaultDialog = false;
170
166
webView.CoreWebView2.FindController.ShouldHighlightAllMatches = true;
171
167
172
168
// Start the find operation with the specified configuration.
@@ -205,7 +201,7 @@ async Task ConfigureAndExecuteFindWithCustomUIAsync(string searchTerm)
205
201
};
206
202
207
203
// Specify that a custom UI will be used for the find operation.
208
- webView .CoreWebView2 .FindController .UseCustomUI = true ;
204
+ webView .CoreWebView2 .FindController .SuppressDefaultDialog = true ;
209
205
webView .CoreWebView2 .FindController .ShouldHighlightAllMatches = true ;
210
206
211
207
// Start the find operation with the specified configuration.
0 commit comments