I have this TabControl defined in mainPage.cs. When I navigate to Page A, a new tab will be added to the TabControl. The purpose of me declaring TabControl in mainPage.cs is to keep the TabControl object alive so that it won't be destructed when I navigate to other page. I can add new tab as I want, but after I navigate to Page B, and go back to Page A, there is "TargetInvocationException" error when I perform the following act:
// Add rootPage.tabControl to gridReport
Grid.SetRow(rootPage.tabControl, 0); // Tab display at Grid.Row = 0
gridReport.Children.Add(rootPage.tabControl); // Add tabControl to gridReport
Note: tabControl is defined in MainPage.cs.
My expectation will be after I navigate to page B, then back to Page A, when I add rootPage.tabControl, the gridReport will display the tabControl, what do I miss out??