Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAUI: Add multi page sample #117

Closed
FakiExx opened this issue Apr 1, 2021 · 3 comments
Closed

MAUI: Add multi page sample #117

FakiExx opened this issue Apr 1, 2021 · 3 comments

Comments

@FakiExx
Copy link

FakiExx commented Apr 1, 2021

It would be really helpful if the HelloMaui sample could be extended to have multiple pages.

I was testing out the HellMaui sample and everything works fine so far. I can run the project on iOS, Android and Mac, I can create ViewModels, bind them to my ContentPage (Basically everything that I'm used to from Xamarin.Forms.) and so on.

However I'm having trouble when it comes to the navigation between pages. The workflow seems to have changed quiet a bit, now that Windows are used. In Xamarin.Forms I could just set the MainPage to be a NavigationPage and I was good to go. Now I'm a bit lost on how to implement similar behavior. Simply changing the IPage during runtime in the Window that is being created on startup does not seem to have any effect.

Would be nice if someone could help me out and point me in the right direction or give me a small example on how I should approach the navigation in MAUI.

Best Regards

@vfongmala
Copy link

Anyone found the solution for navigation yet?

@FakiExx
Copy link
Author

FakiExx commented Jun 23, 2021

Hi there,

for anyone having a similar problem, have a look at the linked repository:

https://github.com/davidortinau/WeatherTwentyOne

It's a weather app implemented using Maui and it already contains navigation. Basically the CreateWindow function needs to contain something similar to this:

return new Window(
    new NavigationPage(
        new HomePage()
    )
);

Since I believe that it is still a good idea to have multiple pages in the official samples I leave the issue open for now.

@chucker
Copy link
Contributor

chucker commented Jul 7, 2021

But neither NavigationPage nor HomePage is a MultiPage.

With XamForms, I could simply have:

        public App()
        {
            InitializeComponent();

            MainPage = new MainPage();
        }

and have MainPage inherit from TabbedPage.

With MAUI, MainPage apparently also has to implement IPage. It's unclear to me how to implement the IPage.View property in a way that work with a multi page such as TabbedPage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants