SfDataGrid not covering entire screen in SfTabView

I have a sfDataGrid, and it's not expanding to cover the entire page of a sfTabView/sfTabItem. I've included a screen capture.

<?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 >

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

                                    <sfDg:GridTextColumn
                                        HeaderText="Name"
                                        MappingName="Name"/>
                                
                                    <sfDg:GridTextColumn
                                        HeaderText="Format"
                                        MappingName="FormatName"/>
                                </sfDg:SfDataGrid.Columns>
                            
                        </sfDg:SfDataGrid>
                        
                    </StackLayout>
                    
                </sfTab:SfTabItem.Content>
                
            </sfTab:SfTabItem>

            <sfTab:SfTabItem
                Title="Details"
                SelectionColor="{DynamicResource ColorMainForeground}"
                TitleFontColor="{DynamicResource  ButtonHomePageForeground}">
                <sfTab:SfTabItem.Content>

                    <StackLayout>
                       

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

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

    </ContentPage.Content>

</ContentPage>

Attachment: sfDataGrid_46d6264c.zip

3 Replies 1 reply marked as answer

CS Chandrasekar Sampathkumar Syncfusion Team February 10, 2021 02:56 PM UTC

Hi Robert, 
Thank you for using Syncfusion products. 
We have checked the reported query “SfDataGrid not covering entire screen in SfTabView” from our end. We have checked the attached screen capture and we can tell that DataGrid is covering the entire screen of SfTabItem, since DataGrid’s background color is filled in the entire screen of SfTabItem. If your requirement is to cover the entire width of SfTabItem with DataGrid columns, then you need to set SfDataGrid.ColumnSizer as Star. When the SfDataGrid.ColumnSizer is Auto, the width of the GridColumns are adjusted based on the header text or cell contents.  
Please refer the following online user documentation on column sizer for more reference, 
Please let us know if you would require further assistance. 
Regards, 
Chandrasekar Sampathkumar 


Marked as answer

RK Robert Kamarowski February 10, 2021 05:10 PM UTC

I tried everything but star... Thank you very much for your help.


CS Chandrasekar Sampathkumar Syncfusion Team February 10, 2021 05:44 PM UTC

Hi Robert,  
Thanks for the update. 
We are glad that the solution helps. 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