hello,
I have a tabbed page with 5 pages. In one of the page, I have listview. I want to open tabbed page from lisview click. It works like this.
- User clicks on listview item, respective data is fetched from server
- create a new object of new tabbed page and add the page to
Children
of tabbed page with data. - Minimise the current tab by clicking on the home icon given in page.
- user selects another item from listview now this time its data is fetched for the second page and add as a child to tabbed page
This functionality is fully functional in android. I am having problem in iOS when I try to open second tab after minimizing first tab.
It gives me following error
{System.InvalidOperationException: Page must not already have a parent. at Xamarin.Forms.Internals.NavigationProxy.PushModalAsync (Xamarin.Forms.Page modal, System.Boolean animated) [0x00008] in D:\a\1\s\Xamarin.Forms.Core\NavigationProxy.cs:128 at Xamarin.Forms.Internals.NavigationProxy.PushModalAsync (Xamarin.Forms.Page modal) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\NavigationProxy.cs:122 at RedPoker.Views.Lobby.NewGameLobby+<<GetProtectedCommand>b__10_0>d.MoveNext () [0x00030] in D:\user\...\NewClass.xaml.cs:196 }
Code on Onclick of list item
MultiTab ObjMultiTab = new MultiTab(); // This is second tabbed page i initialize // Get data from server ObjMultiTab.Data = ObjData; int Id = Convert.ToInt32(ObjData.id); if (ActiveList.ContainsKey(Id)) // Dictionary that contains info about index and pageid that are already open { TabId = ActiveList[ObjData.id]; CurrentPage = Children[TabId]; // If user taps on already opend page } else { Count += 1; ActiveList.Add(Id, Count); Children.Add(new SecondTabbedPage(TableData)); // Or add new child CurrentPage = Children[Count]; } await Application.Current.MainPage.Navigation.PushModalAsync(ObjMultiTab); // I receive error here when trying to push second page. First time it gets called successfully.
I have not used NavigationPage here. I directly set first tab page instance to main page.
Is there any ios validation not to open tabbed page from another one ? Pls help
Thank you