0

I am currently using the Tab Bar Navigation within my project and would like selecting a Tab to open a new External Browser.

I have tried navigating to the page and then loading a webview but this has too many limitations and just will not suffice.

I have googled to the usual 100th degree and I think I am asking to much of .Net Maui as the Tab Bar is for opening Shell Content which I believe is PageContent, but somebody might say No you can do this trick etc.

<Tab Title="Water">
      <Tab.Icon>
      <FontImageSource FontFamily="CustomIcons" Glyph="&#xe90b;" Size="Small"/>
      </Tab.Icon>
      // The line below I would like to have the ContentTemplate open a URL Template etc or 
      // or set a command in there to call my function below.
      <ShellContent ContentTemplate="{DataTemplate views:WaterPage}" />
</Tab>

The Shell Flyout had the Menu option to allow for commands on clicking of Icons, I am wondering if there is something similar I can do so I can have a handler sat on back doing something like below.

    public void OpenWaterWebPage(object sender, EventArgs e)
    {
        Uri uri = new Uri("https://www.MadeUpSiteName.co.uk/WaterSports");

        OpenHyperLink(uri);
    }
Andy Donegan
  • 782
  • 1
  • 9
  • 30
  • *"navigating to the page and then loading a webview"* - Why not navigate to the page, then open the external browser? – ToolmakerSteve Jun 23 '23 at 20:08
  • @ToolmakerSteve Sorry I missed your comment, I did try this at first, firing a direct Call to open a hyperlink, but the problem arose that There was a preload empty and upon closing the external browser I was returned to the empty black page an on each attempt to re-open the page I was returned to the black page. – Andy Donegan Jun 26 '23 at 09:19

1 Answers1

1

I also have struggled with this. There is no way to set a command or events of any sort. You can only open content pages, which is frustrating.

I ended up using Sharpnado Tabs to render the Tabbed view of my apps. You lose the capability of navigating using shell through the tabs. But it enables you to do anything with your tabs and tabs views.

https://github.com/roubachof/Sharpnado.Tabs

If you want to explore this path further I can give you guidance.

  • sorry for the delay, and thank you I was expecting this to be the answer after googling for hours. Just never receiving a definitive YES/NO before I go ahead down another branch has been off putting. I have seen Sharpnado recommended a few times and I think I am going to have to give it a go. Thank you very much for taking the time to respond and I will mark this as the answer as it does confirm No it cant be done and offers an alternative. Cheers :) – Andy Donegan Jun 26 '23 at 09:10