Forum Xamarin Xamarin.Forms

Shell generate Top Tapped Page in Code behind

RasetechRasetech Member
edited March 29 in Xamarin.Forms


thanks for your help in advance. I am working on a Forms Shell App a few days now. My UI is data driven in a lot of aspects and what I am trying to accomplish ist a page that show multiple tabs on tob depending on the model it has.

In other words I try to accomplish the same layout as in the Shells Demo app:

<FlyoutItem Route="animals"
    <Tab Title="Domestic"
        <ShellContent Route="cats"
                      Style="{StaticResource DomesticShell}"
                      ContentTemplate="{DataTemplate views:CatsPage}" />
        <ShellContent Route="dogs"
                      Style="{StaticResource DomesticShell}"
                      ContentTemplate="{DataTemplate views:DogsPage}" />

But starting from an existing link in the FlyoutMenu. Like the level of the "Domestic" tab above, which when navigatet to creates those two or more Shell top tapped pages.

I am aware I could use a TappedPage as ShellContent, but TappedPages get styled a little different I was wondering if i could accomplish this with "native" Shell features.

I already tried something like:

ShellSection tab1 = new ShellSection
Title = "Tab1"
tab1.Items.Add(new ShellContent() { Title = "Test1", Content = new ContentPage() { Title = "Test1" } });
tab1.Items.Add(new ShellContent() { Title = "Test2", Content = new ContentPage() { Title = "Test2" } });

        var current = AppShell.Current.CurrentItem;

but this also adds another entry in the bottom tabs bar and the flyout menu as well, what i don't want.

Has someone an advice?

Sign In or Register to comment.