This link describes how to setup a control template. The control template can be used inside the ContentPage declaration of a content page, as such:
ControlTemplate="{StaticResource MainPageTemplate}"
But the same cannot be done in a TabbedPage. The following is shown:
The property 'ControlTemplate' was not found in type 'TabbedPage'.
I want to use the ControlTemplate to create a custom navigation bar as explained in this tutorial.
The following is the workaround I thought of and tried until now.
Given this navigation stack:
--- App.xaml - MainTabbedPage.xaml - Page1.xaml/Page2.xaml
1) I have created a 'ControlTemplate' in App.Xaml which defines how I want my navigation bar to look like.
2) Removed the default NavigationBar by using the below line in MainTabbedPage.:
NavigationPage.SetHasNavigationBar(this, false);
3) and set the follow line in Page1.xaml and Page2.xaml:
ControlTemplate="{StaticResource MainPageTemplate}"
This does remove the default navigation bar, and does show the custom navigation bar as defined within the ControlTemplate, however, the Tabbed menu shows in the first row, whereas the custom navigation bar shows in the second row. Naturally, I would like it to be the other way round.
Any workarounds that do not entail also create a custom tabbed navigation page? Perhaps any way to extend the Xamarin Forms default tabbed page? Or something different I can do in the aforementioned incomplete workaround?