Closable tab header not working

Neha 20 Reputation points
2025-01-18T12:54:28.4333333+00:00

I am trying to embed Webform to WinForms using webview2 in a tabbed design.

When I click a button in page 1, its content loads in page 2 .

Then I tried to close that page2 using the tabheader close button X.

It closes the page2 , but if I again execute the button click on page 1 it is not working

Seems something still in a disposable state , and when I am again execute button click, it may think like its already opened and so it is not opening the content in new tabpage.

 private void OnCloseButtonClicked(object sender, RoutedEventArgs e)
 {    
     Call the function to remove /dispose the tabpage

 } 
}

Could you please help to find out this issue?

Thanks In Advance!

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,285 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Neha 20 Reputation points
    2025-01-18T16:06:57.7233333+00:00

    Webview.dispose(); resolves this issue.

    0 comments No comments

  2. Jiale Xue - MSFT 48,866 Reputation points Microsoft Vendor
    2025-01-20T07:59:01.78+00:00

    Hi @Neha, Welcome to Microsoft Q&A,

    Because Q&A cannot mark your own answer, in order to allow more people to search for related problems that have been solved.

    I have reposted your answer, you can mark it to help more people.

    The solution to resolves this issue is " Webview.dispose();".

    Best Regards,

    Jiale


    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.