Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Tabbed page with scrollview and Grid, Grid not scrolling

I know there are a lot of posts on this topic but no one seems to solve my issue, I'm trying to place a Grid in a tabbed page and I would like to have it to scroll on both direction on the need.
my xaml code is the following:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             xmlns:local="clr-namespace:AlternaWMS.UIControls"
             xmlns:toolbar="clr-namespace:AlternaWMS.Views.Toolbars;assembly=AlternaWMS"
             xmlns:i18n="clr-namespace:AlternaWMS.Helpers;assembly=AlternaWMS"
             x:Class="AlternaWMS.Views.Inventory.Inventario"
            Title="{i18n:Translate Page_Title_Inventory}">

    <TabbedPage.ToolbarItems>
        <toolbar:PostingToolbar x:Name="toolbarPosting" Clicked="BtnSave_OnClicked"></toolbar:PostingToolbar>
        <local:CToolbarMenu x:Name="toolBarInventory" Clicked="ToolBarInventory_Clicked"/>
    </TabbedPage.ToolbarItems>
    <ContentPage Title="{i18n:Translate Menu_Inventory}">
        <ScrollView Padding="5">
            <StackLayout Padding="0,5">
                <StackLayout>
                    <Label Text="{i18n:Translate Lbl_Warehouse}"/>
                    <Picker  x:Name="cmbLocation" SelectedIndexChanged="CmbLocation_SelectedIndexChanged"/>

                    <Label Text="{i18n:Translate Lbl_Batch}"/>
                    <local:CPicker x:Name="cmbBatch" />

                    <Label Text="{i18n:Translate Lbl_Collocation}" x:Name="lblCollocation" IsVisible="False"/>
                    <!--<Picker x:Name="cmbBin" IsVisible="False" />-->
                    <local:CTextBox x:Name="cmbBin" IsSpellCheckEnabled="False" Unfocused="CmbBin_Unfocused" IsVisible="False" />

                    <StackLayout Padding="5" Orientation="Vertical">
                        <local:CSearchBar x:Name="txtSearch" SearchButtonPressed="TxtSearch_SearchButtonPressed"/>
                        <Label x:Name="lblDescription" HorizontalTextAlignment="Start"/>
                    </StackLayout>
                </StackLayout>

                <Grid ColumnSpacing="25" Padding="0,5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="0.5*"/>
                    </Grid.ColumnDefinitions>

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>

                    <Label x:Name="lblLot" Text="{i18n:Translate Lbl_Lot}" Grid.Row="0" Grid.Column="0" HorizontalTextAlignment="End"/>
                    <local:CTextBox x:Name="txtLot" Unfocused="TxtLot_Unfocused" Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"/>

                    <Label Text="{i18n:Translate Lbl_Deadline}" Grid.Row="1" Grid.Column="0" HorizontalTextAlignment="End" />
                    <DatePicker x:Name="dpExpirationDate"                     
                        Format="dd/MM/yyyy"
                        Grid.Row="1"        
                        Grid.Column="1">
                    </DatePicker>
                    <Switch x:Name="chkExpirationDate" Grid.Row="1" Grid.Column="2"/>

                    <Label Text="{i18n:Translate Lbl_UdM}" Grid.Row="2" Grid.Column="0" HorizontalTextAlignment="End"/>
                    <Picker x:Name="cmbUoM" Grid.Row="2" Grid.Column="1" />
                    <Label x:Name="lblUoM"  Grid.Row="2" Grid.Column="2" HorizontalTextAlignment="End"/>

                    <Label x:Name="lblQty" Text="{i18n:Translate Lbl_Physical_Quantity}" Grid.Row="3" Grid.Column="0" HorizontalTextAlignment="End"/>
                    <local:CTextBox x:Name="txtQuantity" Keyboard="Numeric" Grid.Row="3" Grid.Column="1" />
                    <Label x:Name="lblAvailableQty" Text="0,00" Grid.Row="3" Grid.Column="2" HorizontalTextAlignment="End"/>
                </Grid>

            </StackLayout>
        </ScrollView>
    </ContentPage>

    <ContentPage Title="{i18n:Translate Menu_Details}">
        <ScrollView Padding="5,5" HorizontalScrollBarVisibility="Default" Orientation="Both">
            <Grid x:Name="grdMovements" RowSpacing="1" ColumnSpacing="0">
            </Grid>
        </ScrollView>
    </ContentPage>
</TabbedPage>

I'm adding rows to it programmaticaly in that way
...
grdMovements.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
grdMovements.Children.Add(new CColumnHeaderLabel { Text = Resource.Lbl_Bin }, columnCount, 0);
..
I have tried to add heightrequest and widthrequest and all the other suggestion I have found in other posts but there's no way to make the grid to scroll

Any help is appreciated
Thank You
LnZ

Sign In or Register to comment.