inside one tab i use this code and add button to navigate to another content pageI make a tabbed page in Xamarin Forms And Inside tabbed page I take 4 content page for tab Inside those content page there are some button when I add click event on button . to navigate in another content page . button doesn't fire. Please provide some solution for this problem.
<NavigationPage Title="Home" IconImageSource="HomeGrey.png">
<x:Arguments >
<local:NewHomeScreen Title="Home" ></local:NewHomeScreen>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Pickup" IconImageSource="PickupGrey.png">
<x:Arguments>
<local:PickupPage ></local:PickupPage>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Setting" IconImageSource="settings.png">
<x:Arguments>
<local:NewSetting ></local:NewSetting>
</x:Arguments>
</NavigationPage>
<NavigationPage Title="Support" IconImageSource="SupportGrey.png">
<x:Arguments>
<local:SupportPage ></local:SupportPage>
</x:Arguments>
</NavigationPage>
If you want to switch to the next tab of the
TabbedPageon clicking button, you can try to useEventHandlerto achieve this.I achieved this function,you can refer to the following code:
FirstPage.xaml.cs
FirstPage.xaml
MainPage.xaml.cs
MainPage.xaml
Update:
I did a test using your code, but it threw error
**System.InvalidCastException:** 'Specified cast is not valid.'. Since the current page is aContentPage, so you cannot cast it toTabbedPage.If you want to navigate to another page instead of other tabs, you can try code: