Forum Xamarin Xamarin.Forms

Shell Tab

Angelru9Angelru9 ESMember ✭✭✭
edited March 31 in Xamarin.Forms

Hello,

I want a tab to display a modal page and not a ShellContent, linkedin has it.

is it possible?

Best Answers

  • Angelru9Angelru9 ESMember ✭✭✭
    edited April 2 Accepted Answer

    With Shell Tabs:

      protected override async void OnNavigating(ShellNavigatingEventArgs args)
                {
                    base.OnNavigating(args);
    
                    if (Current?.CurrentItem == null) return;
    
                    var s = args.Target.Location.ToString();
    
                    if (s.Contains("HomeTab"))
                    {
                        args.Cancel();
                        await GoToAsync("Modal");
                    }
                }
    

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Do you mean following code:

      <Tab Title="Browse" Icon="tab_feed.png">
            <local:ItemsPage></local:ItemsPage>
        </Tab>
    

    instead codes?

    <Tab Title="Browse" Icon="tab_feed.png">          
            <ShellContent ContentTemplate="{DataTemplate local:ItemsPage}" />
    </Tab>
    
  • Angelru9Angelru9 ESMember ✭✭✭

    @jezh

    I mean, when you press a tab, a modal opens

  • Angelru9Angelru9 ESMember ✭✭✭
    edited April 2 Accepted Answer

    With Shell Tabs:

      protected override async void OnNavigating(ShellNavigatingEventArgs args)
                {
                    base.OnNavigating(args);
    
                    if (Current?.CurrentItem == null) return;
    
                    var s = args.Target.Location.ToString();
    
                    if (s.Contains("HomeTab"))
                    {
                        args.Cancel();
                        await GoToAsync("Modal");
                    }
                }
    
Sign In or Register to comment.