Click here to Skip to main content
15,888,288 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a Xamarin application that I need to convert from the older stack-based navigation to the new Shell navigation system. All the examples I can find show this being built in XAML, which I cannot do because I do not have a parameterless constructor for my ContentPage classes.

I would like to build my navigation in C# but am struggling to figure this out. I've tried a hundred ways but never seem to get what I expect on the screen.

In particular, I am struggling to create and navigate to the initial 'parent' or 'root' application screen.

Any help or pointers to example code would be most welcome.

Kind wishes - Patrick

What I have tried:

My most recent (extremely scruffy) code is:

public class ShellApp : Shell
{
    public ShellApp()
    {
        Tab home = new Tab()
        {
            Route = "home",

        };
        home.Items.Add
        (
            new ShellContent() { Content = new HomeView( new HomeViewLogic() ) }
        );

        TabBar tb = new TabBar();
        tb.Items.Add( home );

        Items.Add( tb );
    }
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900