I am having issue to implement dynamic tab page in .NET MAUI project. Can we add tabs into Navigation page at runtime to open Webpage. I am trying to implement functionality model like Chrome or Edge to open web URLs in separate tab.
Asked
Active
Viewed 891 times
1 Answers
0
Can we add tabs into Navigation page at runtime to open Webpage
What does the webpage mean? At first, if you want to add a new tab into the TabbedPage when the user operates in the child page, you can use the the following code in the child page:
var tabbedpage = this.Parent as TabbedPage;
tabbedpage.Children.Add(new ChildPage());
And then if the ChildPage just have a webview in it and you want to add a new tab when the webview navigates to a new url. You can add a Navigating
event to the webview and pass the url to the child page.
Update
You can create a construction method which has a parameter for the ChildPage, such as:
public ChildPage(string url)
{
//use the url here
}

Liyun Zhang - MSFT
- 8,271
- 1
- 2
- 14
-
Hi Zhang, I need to create child pages at runtime to open different URLs in each created child page. – Gajendra Singh Sep 15 '22 at 11:45
-
1The code above shows how to create child pages at runtime. @GajendraSingh – Liyun Zhang - MSFT Sep 19 '22 at 01:13
-
Thank you @Liyun Zhang - MSFT - This worked. Appreciate your help!! – Gajendra Singh Sep 19 '22 at 16:43