SfDataGrid not visible in SfTabView

I'm unable to get a SfDataGrid to display on a SfTabView/TabTime page. Strangely enough, a standard Xamarin DataGrid displays with no problem. I have not idea what I'm doing wrong:

<?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:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid"
             xmlns:sfTab="clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms"
             xmlns:sfDg="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms"
             x:Class="Photography.Handbook.Views.LensesPage"
             BackgroundColor="{DynamicResource ColorContentPageBackground}"
             Title="Lenses">
    <ContentPage.Content>
        <sfTab:SfTabView
        
        VisibleHeaderCount="2">
            <sfTab:SfTabItem
            Title="List"
            SelectionColor="{DynamicResource ColorMainForeground}"
            TitleFontColor="{DynamicResource  ButtonHomePageForeground}">
                <sfTab:SfTabItem.Content >

                    <sfDg:SfDataGrid
                        x:Name="xgrid"                        
                        AllowSorting="True"
                        AutoGenerateColumns="False"
                        BackgroundColor="{DynamicResource ColorMainBackground}"
                        ColumnSizer="Auto"
                        ItemsSource="{Binding Lenses}"
                        SelectionMode="Single"
                        HorizontalOptions="FillAndExpand"
                        VerticalOptions="FillAndExpand">
                        <sfDg:SfDataGrid.Columns>

                            <sfDg:GridTextColumn
                                    HeaderText="Name"
                                    MappingName="Name"
                                    />
                            <sfDg:GridTextColumn
                                    HeaderText="Format"
                                    MappingName="Format"/>
                        </sfDg:SfDataGrid.Columns>
                    </sfDg:SfDataGrid>

                </sfTab:SfTabItem.Content>
            </sfTab:SfTabItem>

            <sfTab:SfTabItem
            Title="Details"
            SelectionColor="{DynamicResource ColorMainForeground}"
            TitleFontColor="{DynamicResource  ButtonHomePageForeground}">
                <sfTab:SfTabItem.Content>
                    <dg:DataGrid 
                        ItemsSource="{Binding Lenses}"
                        ActiveRowColor="AliceBlue"
                        HeaderBackground="{DynamicResource ColorMainBackground}"
                        HeaderTextColor="White"
                        IsEnabled="True"
                        IsSortable="True"
                        Padding="2, 2, 2, 2"
                        SelectionEnabled="True">
                        <dg:DataGrid.Columns>
                            <dg:DataGridColumn Title="Name" Width="5*"  >
                                <dg:DataGridColumn.CellTemplate>
                                    <DataTemplate>
                                        <ContentView
                                    BackgroundColor="White"
                                    HorizontalOptions="Fill">
                                            <Label Text="{Binding Name}" 
                                            Style="{DynamicResource DataGridColumnLabel}"/>
                                        </ContentView>
                                    </DataTemplate>
                                </dg:DataGridColumn.CellTemplate>
                            </dg:DataGridColumn>

                            <dg:DataGridColumn Title="Format" Width="1*">
                                <dg:DataGridColumn.CellTemplate>
                                    <DataTemplate>
                                        <ContentView
                                    BackgroundColor="White"
                                    HorizontalOptions="Fill">
                                            <Label Text="{Binding FormatName}" 
                                            Style="{DynamicResource DataGridColumnLabel}"/>
                                        </ContentView>
                                    </DataTemplate>
                                </dg:DataGridColumn.CellTemplate>
                            </dg:DataGridColumn>
                        </dg:DataGrid.Columns>

                        <dg:DataGrid.RowsBackgroundColorPalette>
                            <dg:PaletteCollection>
                                <Color>White</Color>
                            </dg:PaletteCollection>
                        </dg:DataGrid.RowsBackgroundColorPalette>
                    </dg:DataGrid>
                </sfTab:SfTabItem.Content>

            </sfTab:SfTabItem>
        </sfTab:SfTabView>

    </ContentPage.Content>

</ContentPage>

4 Replies 1 reply marked as answer

RK Robert Kamarowski February 8, 2021 04:09 PM UTC

Xamarin.Forms
Visual Studio 2019
.NetStandard 2.1


CS Chandrasekar Sampathkumar Syncfusion Team February 9, 2021 06:41 AM UTC

Hi Robert, 
Thank you for using Syncfusion products. 
We have checked the reported query “SfDataGrid is not visible in SfTabView” from our end. We suggest you to load SfDataGrid inside StackLayout or Grid layout to resolve this issue. 
Regards, 
Chandrasekar Sampathkumar 


Marked as answer

RK Robert Kamarowski February 9, 2021 01:16 PM UTC

Perfect! Thank you.


CS Chandrasekar Sampathkumar Syncfusion Team February 9, 2021 01:39 PM UTC

Hi Robert,  
Thank you for the update. 
We are glad that the reported issue have been resolved at your end. Please let us know if you need any further update. As always we are happy to help you out. 
Regards, 
Chandrasekar Sampathkumar 


Loader.
Up arrow icon