item content not displayed

that is to all, I am trying to create a small app that should have the following layout in xmal but when from code I go to add the content to the item of the tabview unfortunately I do not spit anything, instead if I change the xaml layout and delete the pickers the contents tabview is updated correctly. I enclose some code so I make everything clearer.


<ContentPage.Content>

        <StackLayout x:Name="stackMadre" >

            <Picker x:Name="picTipoServizio" ItemsSource="{StaticResource Servizi}"

                   SelectedIndexChanged="picTipoServizio_SelectedIndexChanged" >

            </Picker>

            <ScrollView x:Name="scrollView" Orientation="Vertical">

            <tabView:SfTabView x:Name="tabView" TabItemTapped="TabView_TabItemTapped"

SelectionChanged="SfTabView_SelectionChanged" >

           </tabView:SfTabView>

              </ScrollView>

        </StackLayout>

    </ContentPage.Content>



and on my code c#



// first function for create the tab item

private void CreateDayTab()

        {

           for (int i = 0; i < 60; i++)

            {

                var data1 = today.AddDays(i).ToString("ddd dd MMM", culture);

                tabView.Items.Add(new SfTabItem(){ Title = data1 }) ;

            }

        }



// then i have this function for creare the content of item dynamics 

// this content return a grid with dynamic element 

 public async Task<Grid> GridComposionAsync()

        { return grid }



// and then the event 

public async void SfTabView_SelectionChanged(object sender, Syncfusion.XForms.TabView.SelectionChangedEventArgs e)

        {

            _titleTabItem = tabView.Items[e.Index].Title;

            tabView.Items[e.Index].Content = await GridComposionAsync();

        }

public async void TabView_TabItemTapped(object sender, TabItemTappedEventArgs e)

        {

            _titleTabItem = e.TabItem.Title;

            e.TabItem.Content = await GridComposionAsync();

        }

doing the necessary tests I am sure that the grid is created correctly because precisely by removing the picker from the xaml or setting the content of the conte page as sftabview everything works correctly, but I need to make it appear in this stacklyout could someone help me?



3 Replies

JK Jeya Kasipandi Syncfusion Team June 29, 2021 02:43 PM UTC

Hi Salvatore Lorello,

Greetings from Syncfusion.

We have validated your query and we suggest you set VerticalOptions and HorizontalOptions for StackLayout , ScrollView, SfTabview to resolve the reported issue. We have created sample based on this and please find the sample from below link


Code snippet:
   <ScrollView x:Name="scrollView" VerticalOptions="FillAndExpand"  HorizontalOptions="FillAndExpand" Orientation="Vertical">
 <tabView:SfTabView x:Name="tabView" VerticalOptions="FillAndExpand"  HorizontalOptions="FillAndExpand"  TabItemTapped="TabView_TabItemTapped"
 SelectionChanged="SfTabView_SelectionChanged" >
  </tabView:SfTabView>
  </ScrollView>

Please check with the above and let us know if you have any concern.

Regards,
Jeya K



SL Salvatore Lorello June 30, 2021 10:42 PM UTC

great function but I have another problem, for the first tab it's ok but for the second tab I have this problem,

the grid is not formed correctly. look the screen.



JK Jeya Kasipandi Syncfusion Team July 1, 2021 11:55 AM UTC

Hi Salvatore Lorello,

Sorry for the inconvenience caused.

We have checked the reported issue, but we are not able to reproduce reported issue in iOS. Please find the tested sample from below link

Sample Link: https://www.syncfusion.com/downloads/support/forum/166745/ze/TABVIE~1-781094333  

Since we are not aware of your exact application scenario, so can you please check with the above sample and if you are still facing the problem, can you please modify the above sample or provide sample, or share information about the dynamic loading tab item content. This will be helpful for us to provide better solution at the earliest.

Regards,
Jeya K 


Loader.
Up arrow icon