0

I use Flyout menu in Xamarin.Forms without App Shell and I need to load a detail page from existing already created pages using a simple button (programmatically) from another details page. How can I implement this? Is there any mechanism for this action?

Thanos
  • 23
  • 4

2 Answers2

0

Of course -- did you even try to find an example in the Microsoft docs?

Assuming your application main page is the flyout page (which it should be) then you can simply call:

((FlyoutPage)Application.Current.MainPage).Detail = myExistingPage

You can also use the detail page as its own navigation stack if it wrapped in a NavigationPage in which case you would do:

await ((FlyoutPage)Application.Current.MainPage).Detail.Navigation.PushAsync(myExistingPage);
CodingLumis
  • 594
  • 2
  • 22
0

If you want to load a detail page from existing already created pages using a simple button (programmatically) from another details page, you could use the code below.

    private void Button_Clicked(object sender, EventArgs e)
    {
        FlyoutPage1 flyoutPage1 = new FlyoutPage1();

        var page = (Page)Activator.CreateInstance(typeof(Page3));
        page.Title = "Page3";

        flyoutPage1.Detail = new NavigationPage(page);
    
        Application.Current.MainPage = flyoutPage1;


    }

For more details about the FlyoutPage, you could check the link below. Lower AppShell Flyout Below Navigation Bar

Wendy Zang - MSFT
  • 10,509
  • 1
  • 7
  • 17