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

Xamarin Forms - Table View Expand complete height

$
0
0

I am using table views in my xamarin forms app. I created a custom renderer to disable scrolling as I dont want that behavior. The problem I am having is that unless I specify a height on the tableview itself bottom sections of the table gets cut off. I obviously dont want to set a specific height as it will vary per device etc.

I have set vertical options for the table view and parent stacklayouts to startandexpand, fill and expand etc but the last tableview sections get cut off. The tablview itself is within a scrollview. Does anyone have suggestions on how I can ensure the whole length of the tableview is present. I also done want uncessary space at the bottom of each tableview which I noticed is also an issue.

Here is what i am encountering. Below the special instructions is text but it is cut off. I am at the bottom of the scrollview as well. I want the scrollview to keep going until the end of the tableview.

Here is my xaml code in the hopes someone sees an issue.

        <ScrollView BackgroundColor="#e8f3f9" VerticalOptions="StartAndExpand" Orientation="Vertical" >  
        <StackLayout Orientation="Vertical" BackgroundColor="#5f8aad" VerticalOptions="StartAndExpand">  

        <StackLayout Spacing="0" Orientation="Vertical" BackgroundColor="White">  

        <ContentView>  
        <StackLayout Orientation="Vertical" Spacing="0" Margin="0">  
        <BoxView BackgroundColor="Silver" HeightRequest="1" HorizontalOptions="FillAndExpand" Margin="0">  
        </BoxView>  
        <maps:Map Margin="0" HasScrollEnabled="false" HasZoomEnabled="false" IsShowingUser="true" x:Name="officeMap" MinimumHeightRequest="150" HeightRequest="150">  
        </maps:Map>  
        <BoxView BackgroundColor="Silver" HeightRequest="1" HorizontalOptions="FillAndExpand" Margin="0">  
        </BoxView>  
        <Grid Margin="10">  
        <Grid.RowDefinitions>  
        <RowDefinition Height="Auto" />  
        </Grid.RowDefinitions>  
        <Grid.ColumnDefinitions>  
        <ColumnDefinition Width="Auto" />  
        <ColumnDefinition Width="*" />  
        </Grid.ColumnDefinitions>  
        <StackLayout Grid.Row="0" Margin="0,5,0,0" Grid.Column="0" Orientation="Vertical" Spacing="0">  
        <Label LineBreakMode="WordWrap" Margin="0" Text="{Binding Address}">  
        </Label>  
        <StackLayout Orientation="Horizontal" Spacing="0" Margin="0">  
        <Label LineBreakMode="WordWrap" Margin="0" Text="{Binding City}">  
        </Label>  
        <Label LineBreakMode="WordWrap" Margin="0" Text="{Binding Zipcode}">  
        </Label>  
        </StackLayout>  
        <Label LineBreakMode="WordWrap" Margin="0" Text="{Binding County}">  
        </Label>  

        </StackLayout>  

        </Grid>  
        <BoxView BackgroundColor="Silver" HeightRequest="1" HorizontalOptions="FillAndExpand" Margin="0">  
        </BoxView>  
        </StackLayout>  
        </ContentView>  
        <ContentView VerticalOptions="StartAndExpand" >  
        <StackLayout Orientation="Vertical" VerticalOptions="StartAndExpand" Spacing="0">  
        <TableView x:Name="tableRoot" HasUnevenRows="true" Margin="0" Intent="Menu" BackgroundColor="#e8f3f9" VerticalOptions="StartAndExpand">  
        <TableRoot>  
        <TableSection Title="Details">  
        <ViewCell Tapped="DirectionsTapped">  
        <StackLayout Orientation="Horizontal" VerticalOptions="Center" BackgroundColor="White">  
        <Image Source="phone.png" Margin="5,0" HorizontalOptions="Center">  
        </Image>  
        <Label Text="Get Directions" VerticalOptions="Center" HorizontalTextAlignment="Start">  
        </Label>  
        </StackLayout>  
        </ViewCell>  
        <ViewCell Tapped="phoneClicked">  
        <StackLayout Orientation="Horizontal" VerticalOptions="Center" BackgroundColor="White">  
        <Image Source="phone.png" Margin="5,0" HorizontalOptions="Center">  
        </Image>  
        <Label Text="Call" VerticalOptions="Center" HorizontalTextAlignment="Start">  
        </Label>  
        <Label Text="{Binding Phone}" VerticalOptions="Center">  
        </Label>  
        </StackLayout>  
        </ViewCell>  
        <ViewCell Tapped="Handle_Clicked">  
        <StackLayout Orientation="Horizontal" VerticalOptions="Center" BackgroundColor="White">  
        <Image Source="feedback.png" Margin="5,0" HorizontalOptions="Center">  
        </Image>  
        <Label Text="Leave Feedback" VerticalOptions="Center" HorizontalOptions="Start">  
        </Label>  
        </StackLayout>  
        </ViewCell>  
        <ViewCell Tapped="WebsiteClicked">  
        <StackLayout Orientation="Horizontal" VerticalOptions="Center" BackgroundColor="White">  
        <Image Source="feedback.png" Margin="5,0" HorizontalOptions="Center">  
        </Image>  
        <Label Text="Website" VerticalOptions="Center" HorizontalOptions="Start">  
        </Label>  
        </StackLayout>  
        </ViewCell>  

        </TableSection>  
        <TableSection Title="Office Hours">  
        <ViewCell IsEnabled="false" Tapped="DirectionsTapped">  
        <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="White">  
        <Label LineBreakMode="WordWrap" Margin="15" Text="{Binding OfficeHoursDescription}">  
        </Label>  
        </StackLayout>  
        </ViewCell>  
        </TableSection>  

        <TableSection Title="Special Instructions">  
        <ViewCell IsEnabled="false" Tapped="DirectionsTapped">  
        <StackLayout Orientation="Horizontal" VerticalOptions="FillAndExpand" BackgroundColor="White">  
        <Label LineBreakMode="WordWrap" Margin="15" Text="{Binding SpecialInstructions}">  
        </Label>  
        </StackLayout>  
        </ViewCell>  
        </TableSection>  

        </TableRoot>  
        </TableView>  
        </StackLayout>  
        </ContentView>  


        </StackLayout>  



        </StackLayout>  
        </ScrollView>

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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