CoreWebView2Find.StartAsync(CoreWebView2FindOptions) Method

Definition

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, Start must be called again with a new or modified FindOptions object. Start 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 Start 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 Start. If Start 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 Start without altering its parameters will behave either as FindNext or FindPrevious, depending on the most recent search action performed. Start 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.

public System.Threading.Tasks.Task StartAsync (Microsoft.Web.WebView2.Core.CoreWebView2FindOptions options);
member this.StartAsync : Microsoft.Web.WebView2.Core.CoreWebView2FindOptions -> System.Threading.Tasks.Task
Public Function StartAsync (options As CoreWebView2FindOptions) As Task

Parameters

Returns

Applies to