Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

MasterDetail and navigationpage problem

$
0
0

Hi guys,

I have a project with a masterdetail with menu.
I followed this example https://www.syntaxismyui.com/xamarin-forms-masterdetail-page-navigation-recipe/

Well... ok, masterdetail and the navigation works!

But now I need create a new page that will be called by some option of menu and will have a listview and when I tap in some option of list I want call a new navigationpage with back button.
Well... I did this and works:

_myList.ItemTapped += async (object sender, ItemTappedEventArgs e) =>
{
           var optSelected = (MyModel)e.Item;
           var detailPage = new DetailPage(optSelected);
           await Navigation.PushAsync(detailPage);
};

But when I tap another item, the details page opens twice and I need press back button twice to back to masterdetail page... and if I tap again, the details opens three times and I need press back buttion three times to back.... and if I tap again, four times is showed.

It seems to me that is created one instance of the details page for each click in the listview.....

My detail page:

public class IndicacoesDetalhesPage : ContentPage
     {
         public DetailPage(MyModel objModel)
         {
             Content = new StackLayout
             {
                 Children = {
                     new Label { Text = objModel.SomeField }
                 }
             };
         }
}

What I doing wrong?

Tks...


Viewing all articles
Browse latest Browse all 91519

Trending Articles