We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Open NavigationPage into SfTabItem

Hi,

it's possible on click or on tapped or selectionchanged call a NavigationPage in SfTabItem?

And if possible there's an example?

My syncfusion release is 20.3.0.47

Thank You b


3 Replies

RS Ruba Shanmugam Syncfusion Team October 20, 2022 12:47 PM UTC

Hi Fabio,


Query: Open NavigationPage into SfTabItem


We have created a sample as per your requirement. We have SelectionChanged event support, so we can navigate to the main page based on the selected index of TabView. We have prepared a new sample for your reference. In this sample, we have navigated to the HomePage when the selection index is 2.


Please get the sample from the attachments and let us know if you need any other details.


Regards,

Ruba Shanmugam


Attachment: TabView_NavigateTabItemClick_aeafe4df.zip


FA Fabio November 1, 2022 01:23 PM UTC

Hi,

I am trying your example code in my project but it generates an error in the xaml file which is the following:

The 'Content' property does not support values of type 'Home'

Where am I wrong?

this is my code xaml:


<?xml version="1.0" encoding="utf-8" ?>

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"

             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

             xmlns:tabView="clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms"

             x:Class="Finimpresa.Page1"

             xmlns:local="clr-namespace:Finimpresa"

             x:Name="MainView"

             NavigationPage.HasNavigationBar="False">

    <ContentPage.Content>

        <tabView:SfTabView OverflowMode="DropDown"

                           SelectionChanged="SfTabView_SelectionChanged"

                           VisibleHeaderCount="3"

                           EnableSwiping="True"

                           BackgroundColor="#583068">

            <tabView:SfTabView.SelectionIndicatorSettings>

                <tabView:SelectionIndicatorSettings

                    Position="Bottom"

                    AnimationDuration="500"

                    StrokeThickness="2"/>

            </tabView:SfTabView.SelectionIndicatorSettings>


            <tabView:SfTabItem Title="Home" >

                <tabView:SfTabItem.Content>

                    <local:Home/>

                </tabView:SfTabItem.Content>

            </tabView:SfTabItem>


            <tabView:SfTabItem Title="Notizie">

                <tabView:SfTabItem.Content>

                    <local:News/>

                </tabView:SfTabItem.Content>

            </tabView:SfTabItem>

        </tabView:SfTabView>

    </ContentPage.Content>

</ContentPage>


Ty



RS Ruba Shanmugam Syncfusion Team November 2, 2022 10:00 AM UTC

Hi Fabio,


Query: The 'Content' property does not support values of type 'Home'


We suspect you are using a ContentPage for the TabItem content. In our current implementation, we can only set Xamarin.Form.View as SfTabItem Content, so we don’t have support for loading the page as TabItem Content directly. We have already logged a feature report for this requirement and it can be tracked through our feature management system.  


https://www.syncfusion.com/feedback/1209/provide-content-page-support-for-sftabitem


To achieve your requirement, you can set content page content as tab item content. Can you please refer to the following KB link to load the ContentPage content to the SfTabItem,


KB Link: https://www.syncfusion.com/kb/11041/how-to-load-different-content-page-as-tab-items-content


Please get back to us, if you have any concerns.


Regards,

Ruba Shanmugam


Loader.
Live Chat Icon For mobile
Up arrow icon