How to open fullscreen page from MasterDetail

Hikari91Hikari91 ITMember ✭✭✭

I have a MasterDetailPage that have like a Detail, a ContentPage with a ListView.

When a user tap on a list element, I need to open a fullscreen page that contains the detail of the tapped element.

How can I do this?

I have tried to do

await BaseViewModel.NavigationService.PushAsync(NavigationPage(MyPage));

but it did not work, nothing happens.

BaseViewModel.NavigationService is the NavigationPage of the MasterPage:

<?xml version="1.0" encoding="utf-8" ?>
<MasterDetailPage
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:views="clr-namespace:SgatMobileV3.Views"
    xmlns:core="clr-namespace:SgatMobileV3.Core"
    core:LocatorViewModel.AutoWireViewModel="True"
    x:Class="SgatMobileV3.Views.MainPage">

    <MasterDetailPage.Master>
        <views:MenuPage x:Name="MenuPage" />
    </MasterDetailPage.Master>

    <MasterDetailPage.Detail>
        <NavigationPage x:Name="NavigationServicePage">
            <x:Arguments>
                <views:EmptyPage />
            </x:Arguments>
        </NavigationPage>
    </MasterDetailPage.Detail>
</MasterDetailPage>

then in the Init of the page I do this:

public MainPage()
{
    InitializeComponent();
    MasterBehavior = MasterBehavior.Popover;

    BaseViewModel.NavigationService = NavigationServicePage;
}

The Page that I would like to open at the tap event, is another MasterDetailPage.

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    Could you please post a basic demo so that we can test with it?

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @Hikari91 Do you mean a Modal page? If so try PushModalAsync() instead...

  • Hikari91Hikari91 ITMember ✭✭✭

    @ShantimohanElchuri said:
    @Hikari91 Do you mean a Modal page? If so try PushModalAsync() instead...

    Hi,
    I have tried to done this, but nothing happens.
    Same with PushAsync(), nothing happens literally on the screen :/

  • ShantimohanElchuriShantimohanElchuri USMember ✭✭✭✭✭

    @Hikari91 said:

    @ShantimohanElchuri said:
    @Hikari91 Do you mean a Modal page? If so try PushModalAsync() instead...

    Hi,
    I have tried to done this, but nothing happens.
    Same with PushAsync(), nothing happens literally on the screen :/

    Then you have to share your XAML / Code behind how you have created the master and details and how you are navigating to a detail page.

Sign In or Register to comment.