How to remove the handle.

chen chen 20 Reputation points
2023-01-26T06:58:28.81+00:00

wv1().CoreWebView2().NavigationCompleted({this, &MainWindow::Wv1_NavigationCompleted });

how to remove &MainWindow::Wv1_NavigationCompleted handler.

tags :winui3/winrt/webview2

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
725 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,527 questions
0 comments No comments
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 14,751 Reputation points Microsoft Vendor
    2023-01-26T08:23:22.02+00:00

    Hi @chen chen

    Welcome to Microsoft Q&A!

    Refer to @Viorel 's answer in this thread.

    You can define a event_token and use it again in NavigationCompleted.

    event_token event = wv1().CoreWebView2().NavigationCompleted({this, &MainWindow::Wv1_NavigationCompleted });
    wv1().CoreWebView2().NavigationCompleted(event);
    

    You can also define boolean to choose whether this handler is required.

    bool m_bIsNeededNavigationCompleted = false;
    if (m_bIsNeededNavigationCompleted)
    {
         wv1().CoreWebView2().NavigationCompleted({ this, &MainWindow::Wv1_NavigationCompleted });
    }
    

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. chen chen 20 Reputation points
    2023-01-26T09:29:57.7766667+00:00

    Thank you .

    0 comments No comments