Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 89864

Tabbed page with scrollview and Grid, Grid not scrolling

$
0
0

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


Viewing all articles
Browse latest Browse all 89864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>