Maximum height of item in listview? - xaml

I have this listview in my app that shows a chat. But at a certain point, the messages are getting cut like here:
Listview with cutoff text
The text in the longer boxes is actually more, it just gets cut off.
I wrapped the text element inside a scrollview, so the user can actually scroll inside the message but id prefet it, if the whole text was shown.
It is as if the listview has a maximum row height?
Here is my view:
<ListView
Margin="20,0,20,0"
SeparatorVisibility="None"
IsPullToRefreshEnabled="True"
VerticalScrollBarVisibility="Never"
Refreshing="listview_AllChats_Refreshing"
HasUnevenRows="True"
x:Name="listview_AllChats" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Margin="0,15,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" >
<Frame
Grid.Column="0"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="Start" >
<Image
x:Name="circle_profilepic"
Aspect="AspectFill"
IsVisible="{Binding isMyMessage}"
WidthRequest="500"
HeightRequest="500"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="{Binding myUserPicture}">
</Image>
</Frame>
</Grid>
<Grid Grid.Column="1" >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Frame BorderColor="#424242" HasShadow="False" CornerRadius="25"/>
<ScrollView VerticalScrollBarVisibility="Never">
<Label
Text="{Binding message}"
FontSize="15"
Margin="25,1,25,0"
VerticalOptions="Center"
HorizontalTextAlignment="Start"
HorizontalOptions="Start"
FontFamily="Font_11"
TextColor="#424242"
/>
</ScrollView>
<!--
<Label
Text="{Binding date}"
FontSize="15"
Grid.Row="1"
VerticalOptions="Center"
HorizontalTextAlignment="Start"
HorizontalOptions="Start"
FontFamily="Font_11"
TextColor="#424242"
/>
-->
</Grid>
</Grid>
<Grid Grid.Column="2" >
<Frame
Grid.Column="0"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="End" >
<Image
Aspect="AspectFill"
IsVisible="{Binding isMyPatnersMessage}"
WidthRequest="500"
HeightRequest="500"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="{Binding myPartnerUserPicture}">
</Image>
</Frame>
</Grid>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
So how can I make it all be shown at once?

From shared code, there are some unintelligible code may occur this phenomenon.
First, you are re-wrapping Grid inside root Grid layout, as follows:
<Grid Margin="0,15,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" > // here re-use Grid
<Frame Grid.Column="0"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="Start" >
...
Second, the HeightRequest and WidthRequest of image is larger then its container view(Frame).
<Grid Grid.Column="2">
<Frame Grid.Column="0"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="End">
<Image Aspect="AspectFill"
IsVisible="{Binding isMyPatnersMessage}"
WidthRequest="500" // larger then 40
HeightRequest="500" // larger then 40
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="{Binding myPartnerUserPicture}">
</Image>
</Frame>
Therefore, modify xaml code as follows to check:
<Grid Margin="0,15,0,15">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Frame Grid.Column="0"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="Start">
<Image x:Name="circle_profilepic"
Aspect="AspectFill"
WidthRequest="40"
HeightRequest="40"
IsVisible="{Binding isMyMessage}"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="{Binding myUserPicture}">
</Image>
</Frame>
<Frame Grid.Column="1"
BorderColor="#424242"
HasShadow="False"
CornerRadius="25">
<Label Text="{Binding Address}"
FontSize="15"
Margin="25,1,25,0"
HorizontalTextAlignment="Start"
FontFamily="Font_11"
TextColor="#424242" />
</Frame>
<Frame Grid.Column="2"
BackgroundColor="#00000000"
WidthRequest="40"
HeightRequest="40"
CornerRadius="{OnPlatform Android=60, iOS=47}"
IsClippedToBounds="True"
HasShadow="False"
Padding="0"
VerticalOptions="Start"
HorizontalOptions="End">
<Image Aspect="AspectFill"
WidthRequest="40"
HeightRequest="40"
IsVisible="{Binding isMyPatnersMessage}"
HorizontalOptions="CenterAndExpand"
VerticalOptions="CenterAndExpand"
Source="{Binding myPartnerUserPicture}">
</Image>
</Frame>
</Grid>
Here is the effect:

Related

xamarin.forms: Images just dont seem to scale up to their container

Someone please help me out here!!
This image is inside a stacklayout, which is inside a scrollview. Thats basically it.
Watch this:
<Image BackgroundColor="Green" x:Name="img_mainPic"/>
Great, my picture is shown in its original size I guess, but left and right there a big green bars - empty space.
Lets add:
VerticalOptions="FillAndExpand"
We get:
Wtf is it doing?? Why are the green bars now at the bottom??
Ok, lets try to add:
Aspect="AspectFill"
Great, thats just so much better. Excatly what I wanted.
Ok but now for realsis:
How hard can it be to scale my image without giving it a fixed height? (because then it would work, but other pictures in others formats wont anymore...)
FULLCODE:
<?xml version="1.0" encoding="UTF-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
BackgroundColor="White"
xmlns:helpers="clr-namespace:Khaled.Helpers"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:abstractions="clr-namespace:Plugin.CrossPlatformTintedImage.Abstractions;assembly=Plugin.CrossPlatformTintedImage.Abstractions"
x:Class="Khaled.Views.Page_FullAd">
<NavigationPage.TitleView>
<Grid>
</Grid>
</NavigationPage.TitleView>
<ContentPage.Content>
<RefreshView IsRefreshing="False" x:Name="refreshview_view" Refreshing="RefreshView_Refreshing">
<ScrollView>
<StackLayout Spacing="0">
<Image Aspect="AspectFill" VerticalOptions="FillAndExpand" x:Name="img_mainPic"/>
<BoxView HeightRequest="1" BackgroundColor="{StaticResource LightGray}"/>
<Grid HeightRequest="50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Frame x:Name="frame_telephone" Padding="10" HasShadow="False">
<Image Source="btn_telephone" VerticalOptions="Center" HorizontalOptions="Center"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Frame.GestureRecognizers>
</Frame>
<Frame x:Name="frame_gps" Grid.Column="1" Padding="10" HasShadow="False">
<Image Source="btn_gps" VerticalOptions="Center" HorizontalOptions="Center"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Frame.GestureRecognizers>
</Frame>
<Frame x:Name="frame_mail" Margin="2" Grid.Column="2" Padding="10" HasShadow="False">
<Image Source="btn_mail" VerticalOptions="Center" HorizontalOptions="Center"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Frame.GestureRecognizers>
</Frame>
<Frame x:Name="frame_share" Grid.Column="3" Padding="10" HasShadow="False">
<Image Source="btn_share" VerticalOptions="Center" HorizontalOptions="Center"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Frame.GestureRecognizers>
</Frame>
<Frame CornerRadius="0" x:Name="frame_heart" Grid.Column="4" Padding="10" HasShadow="False">
<abstractions:TintedImage TintColor="Transparent"
VerticalOptions="Center"
HorizontalOptions="Center"
Source="img_fav"
x:Name="img_heart"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Frame.GestureRecognizers>
</Frame>
</Grid>
<BoxView HeightRequest="1" BackgroundColor="{StaticResource LightGray}"/>
<Grid ColumnSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Frame CornerRadius="0" Padding="5,10,5,5" x:Name="tab1" HasShadow="False" BackgroundColor="White">
<Label FontSize="13"
FontAttributes="Bold"
VerticalOptions="Center"
TextColor="{StaticResource TextBlack}"
HorizontalOptions="Center"
Text="{helpers:Translate DESCRIPTION}"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_tabs"/>
</Frame.GestureRecognizers>
</Frame>
<Frame CornerRadius="0" Padding="5" x:Name="tab2" HasShadow="False" BackgroundColor="{StaticResource TabGray}" Grid.Column="1">
<Label FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource TextBlack}"
VerticalOptions="Center"
HorizontalOptions="Center"
Text="{helpers:Translate ACTIONS}"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_tabs"/>
</Frame.GestureRecognizers>
</Frame>
<Frame CornerRadius="0" Padding="5" x:Name="tab3" HasShadow="False" BackgroundColor="{StaticResource TabGray}" Grid.Column="2" >
<Label FontSize="13"
FontAttributes="Bold"
TextColor="{StaticResource TextBlack}"
VerticalOptions="Center"
HorizontalOptions="Center"
Text="{helpers:Translate BOOKSLOT}"/>
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_tabs"/>
</Frame.GestureRecognizers>
</Frame>
</Grid>
<!--changeable layouts-->
<StackLayout Margin="0,10,0,0" BackgroundColor="White" Padding="15" x:Name="layout1">
<Label TextColor="{StaticResource TextBlack}" x:Name="label_description"/>
<Grid Margin="0,30,0,0" RowSpacing="15" BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
<RowDefinition Height="30"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label x:Name="label_adresse"
VerticalOptions="Center"
FontSize="14"
Grid.Row="0" Grid.Column="1">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="label_hours"
VerticalOptions="Center"
FontSize="14"
Grid.Row="1" Grid.Column="1"/>
<Label x:Name="label_telephone"
VerticalOptions="Center"
FontSize="14"
Grid.Row="2" Grid.Column="1">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="label_email"
VerticalOptions="Center"
FontSize="14"
Grid.Row="3" Grid.Column="1">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Label.GestureRecognizers>
</Label>
<Label x:Name="label_web"
VerticalOptions="Center"
FontSize="14"
Grid.Row="4" Grid.Column="1">
<Label.GestureRecognizers>
<TapGestureRecognizer Tapped="Tapped_Quicks"/>
</Label.GestureRecognizers>
</Label>
<Image Source="btn_gps"
Grid.Row="0" Grid.Column="0"/>
<Image Source="btn_clock"
Grid.Row="1" Grid.Column="0"/>
<Image Source="btn_telephone"
Grid.Row="2" Grid.Column="0"/>
<Image Source="btn_mail"
Margin="3"
Grid.Row="3" Grid.Column="0"/>
<Image Source="btn_web"
Grid.Row="4" Grid.Column="0"/>
</Grid>
</StackLayout>
</StackLayout>
</ScrollView>
</RefreshView>
</ContentPage.Content>
</ContentPage>
To scale up the image to its container, you can use a frame and binding its height to the image height and then set Aspect="AspectFill".
Below is the XAMl code for your reference:
<ScrollView>
<StackLayout Spacing="0">
<Grid HorizontalOptions="Center" Margin="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Frame Padding="0" Margin="0" HeightRequest="{Binding Source={x:Reference image}, Path=Height}" HasShadow="False" Grid.Row="0" Grid.Column="0" VerticalOptions="Start" >
<Image x:Name="image" Source="uk.png" Aspect="AspectFill" HeightRequest="70" />
</Frame>
</Grid>
</StackLayout>
</ScrollView>
Update:
You may need to set the HeightRequest="70" of the image.

get image to display on same row as text in a GRID

why does the below code have the picture and the labels on different rows...I want them all on the same row in different columns...so keeping the labels where they are in horizontal order ...and moving the image down to the same level
Desired:
Vodka
700ml
Image 13.99
current:
<Grid RowSpacing="25">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<CarouselView ItemsSource="{Binding OffersList}" PeekAreaInsets="20">
<CarouselView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="10"/>
</CarouselView.ItemsLayout>
<CarouselView.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="30" Margin="20" BackgroundColor="Black" HeightRequest="500">
<StackLayout>
<Image Grid.Column="1" Grid.Row="1" Source="{Binding Img}" WidthRequest="100" HeightRequest="100" Aspect="AspectFit" HorizontalOptions="Start"/>
<Label Grid.Column="2" Grid.Row="1" Text="{Binding Name}" WidthRequest="100" BackgroundColor="Red" FontSize="Title" HorizontalOptions="End"/>
<Label Grid.Column="2" Grid.Row="1" Text="{Binding Des}" WidthRequest="100" BackgroundColor="Blue" FontSize="Title" HorizontalOptions="End" />
<Label Grid.Column="2" Grid.Row="1" Text="{Binding FullPrice, StringFormat='£{0:0.00}'}" WidthRequest="100" BackgroundColor="Pink" FontSize="Title" HorizontalOptions="End"/>
</StackLayout>
</Frame>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
you are not actually using a Grid, you are using a StackLayout
<Grid>
<Grid.ColumnDefintions>
<ColumnDefintion Width="25*" />
<ColumnDefintion Width="25*" />
<ColumnDefintion Width="25*" />
<ColumnDefintion Width="25*" />
</Grid.ColumnDefintions>
<Image Grid.Column="0" Grid.Row="0" Source="{Binding Img}" WidthRequest="100" HeightRequest="100" Aspect="AspectFit" HorizontalOptions="Start"/>
<Label Grid.Column="1" Grid.Row="0" Text="{Binding Name}" WidthRequest="100" BackgroundColor="Red" FontSize="Title" HorizontalOptions="End"/>
<Label Grid.Column="2" Grid.Row="0" Text="{Binding Des}" WidthRequest="100" BackgroundColor="Blue" FontSize="Title" HorizontalOptions="End" />
<Label Grid.Column="3" Grid.Row="0" Text="{Binding FullPrice, StringFormat='£{0:0.00}'}" WidthRequest="100" BackgroundColor="Pink" FontSize="Title" HorizontalOptions="End"/>
</Grid>
If you want to achieve the layout you want above,you should move the Grid into your <CarouselView.ItemTemplate>,like:
<CarouselView.ItemTemplate>
<DataTemplate>
<Frame CornerRadius="30" Margin="20" BackgroundColor="Black" HeightRequest="500">
<StackLayout>
<Grid RowSpacing="25">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" Source="{Binding Img}" WidthRequest="100" Aspect="AspectFit" HorizontalOptions="Start" VerticalOptions="End"/>
<Label Grid.Column="1" Grid.Row="0" Text="{Binding Name}" WidthRequest="100" BackgroundColor="Red" FontSize="Title" HorizontalOptions="End" VerticalOptions="End"/>
<Label Grid.Column="1" Grid.Row="1" Text="{Binding Des}" WidthRequest="100" BackgroundColor="Blue" FontSize="Title" HorizontalOptions="End" VerticalOptions="End"/>
<Label Grid.Column="1" Grid.Row="2" Text="{Binding FullPrice, StringFormat='£{0:0.00}'}" WidthRequest="100" BackgroundColor="Pink" FontSize="Title" HorizontalOptions="End" VerticalOptions="End"/>
</Grid>
</StackLayout>
</Frame>
</DataTemplate>
</CarouselView.ItemTemplate>

xamarin forms: the page becomes extremely large and I am not sure why

<ContentPage.Content>
<ScrollView>
<StackLayout HorizontalOptions="FillAndExpand" Padding="0">
<Label FontSize="Large" Margin="6" HorizontalTextAlignment="Center" Text="Revisión Técnica" HorizontalOptions="Center"></Label>
<BoxView HorizontalOptions="FillAndExpand" HeightRequest="3" Color="Black"></BoxView>
<StackLayout IsVisible="True" Orientation="Horizontal" Padding="0" x:Name="ContainerSec" HorizontalOptions="FillAndExpand">
<StackLayout Padding="0" Spacing="0">
<StackLayout BackgroundColor="LightGray" Padding="0">
<Label Margin="8" VerticalOptions="Center" VerticalTextAlignment="Center" Text="Lista de detalles"></Label>
</StackLayout>
<StackLayout Padding="0" Spacing="0" x:Name="VisualColumnWRP" WidthRequest="{Binding widthCol,Source={x:Reference Pagexaml}}" MinimumWidthRequest="{Binding widthCol,Source={x:Reference Pagexaml}}">
</StackLayout>
</StackLayout>
<BoxView WidthRequest="3" VerticalOptions="FillAndExpand" Color="{StaticResource type2-color}"></BoxView>
<StackLayout Padding="0" Spacing="0" HorizontalOptions="FillAndExpand" VerticalOptions="Start">
<Grid x:Name="ElGrid" HorizontalOptions="FillAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="0"/>
<RowDefinition x:Name="row1" Height="Auto"></RowDefinition>
<RowDefinition x:Name="row2" Height="Auto"/>
<RowDefinition x:Name="row3" Height="Auto"></RowDefinition>
<RowDefinition x:Name="row4" Height="Auto"/>
<RowDefinition x:Name="row5" Height="Auto"></RowDefinition>
<RowDefinition x:Name="row6" Height="Auto"/>
<RowDefinition Height="0"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Garantía"></Label>
<Label Grid.Row="1" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Garantia"></Label>
<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Descripción"></Label>
<Label Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Description"></Label>
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalOptions="End" Margin="5" Text="Detalle"></Label>
<Label Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="3" HorizontalOptions="Start" Margin="5" x:Name="Detail"></Label>
<StackLayout Orientation="Horizontal" Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="5">
<Label Margin="5" Text="Estado"></Label>
<suave:MaterialPicker x:Name="Picker" HorizontalOptions="FillAndExpand" Margin="5"></suave:MaterialPicker>
</StackLayout>
<StackLayout Orientation="Horizontal" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="5">
<Label Margin="5" Text="Nota"></Label>
<Editor x:Name="EditorWRP" HeightRequest="100" HorizontalOptions="FillAndExpand"></Editor>
</StackLayout>
<StackLayout Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="5">
<suave:MaterialButton Clicked="MaterialButton_Clicked" BackgroundColor="LightGray" Text="Agregar evidencia" Margin="5"></suave:MaterialButton>
</StackLayout>
</Grid>
</StackLayout>
</StackLayout>
<Image x:Name="GalleryImage"></Image>
</StackLayout>
</ScrollView>
</ContentPage.Content>
the previous code generate the next screen but is height is a lot bigger than the height of the tablet emulator and I don't know why.
The only way that I solved it was declaring the grid with fix height, but even when the window is big and I checked its height value, turns out to be small. Thank you for your help
You can put your scroll view into absolute layout and set bounds and flags - it should work

Xamarin - Not occupying the whole area in the screen using grid

I have 4 buttons in the bottom part of the screen as menus and I had used grid to show 4 buttons with same width and height and will occupy the whole screen. I have these codes but the result is not they way i wanted. It is not occupying the whole screen. Please help me how can I achieve it. Thanks.
<AbsoluteLayout BackgroundColor="#BC3022" MinimumHeightRequest="20" Padding="0,10,10,10" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView Grid.Row="0" Grid.Column="0"/>
<StackLayout Grid.Row="0" Grid.Column="0" Padding="10,2,10,2">
<Image Source="home.png" WidthRequest="40" HeightRequest="25"/>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Home</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="1"/>
<StackLayout Grid.Row="0" Grid.Column="1" Padding="10,2,10,2">
<Image Source="jobs.png" WidthRequest="40" HeightRequest="25">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnJobsGestureTap" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Jobs</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="2"/>
<StackLayout Grid.Row="0" Grid.Column="2" Padding="10,2,10,2">
<Image Source="sync.png" WidthRequest="40" HeightRequest="25"/>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Sync</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="3"/>
<StackLayout Grid.Row="0" Grid.Column="3" Padding="10,2,10,2">
<Image Source="logout.png" WidthRequest="40" HeightRequest="25">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLogoutGestureTap" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Signout</Label>
</StackLayout>
</Grid>
</AbsoluteLayout>
This is how it looks:
Try to replace your code with below code:
<StackLayout BackgroundColor="#BC3022" MinimumHeightRequest="20" Padding="10,10,10,10" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="25*" />
</Grid.ColumnDefinitions>
<BoxView Grid.Row="0" Grid.Column="0"/>
<StackLayout Grid.Row="0" Grid.Column="0" Padding="10,2,10,2">
<Image Source="home.png" WidthRequest="40" HeightRequest="25"/>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Home</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="1"/>
<StackLayout Grid.Row="0" Grid.Column="1" Padding="10,2,10,2">
<Image Source="jobs.png" WidthRequest="40" HeightRequest="25">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnJobsGestureTap" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Jobs</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="2"/>
<StackLayout Grid.Row="0" Grid.Column="2" Padding="10,2,10,2">
<Image Source="sync.png" WidthRequest="40" HeightRequest="25"/>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Sync</Label>
</StackLayout>
<BoxView Grid.Row="0" Grid.Column="3"/>
<StackLayout Grid.Row="0" Grid.Column="3" Padding="10,2,10,2">
<Image Source="logout.png" WidthRequest="40" HeightRequest="25">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnLogoutGestureTap" NumberOfTapsRequired="1" />
</Image.GestureRecognizers>
</Image>
<Label Text="" TextColor="White" FontSize="15" HorizontalOptions="Center">Signout</Label>
</StackLayout>
</Grid>
</StackLayout>

Xamarin Form retains space between BoxView and Button even after applying spacing and padding

I have following ContentPage in Xamarin Forms. It has a grid. I have applied ColumnSpacing="0" RowSpacing="0" Padding="0" for grid. And I have applied Margin="0" for BoxView and Button. Still there is space between BoxView and Button.
What is the best way to avoid this unwanted spacing?
XAML
<Grid x:Name="controlGrid" ColumnSpacing="0" RowSpacing="0" Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="4*" />
<RowDefinition Height="4*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--Row 1-->
<views:SKCanvasView PaintSurface="OnSecondPainting" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" >
</views:SKCanvasView>
<!--Row 2-->
<Grid x:Name="secondGrid" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" ColumnSpacing="0" RowSpacing="0" Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Red" HeightRequest="1" VerticalOptions="End" HorizontalOptions="FillAndExpand" Margin="0" />
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Green" HeightRequest="1" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Blue" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="End" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Orange" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="Start" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Crimson" HeightRequest="1" VerticalOptions="End" HorizontalOptions="FillAndExpand" Margin="0" />
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Cyan" HeightRequest="1" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Blue" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="End" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Orange" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="Start" Margin="0"/>
<Button x:Name="ClickMe1" Text="ClickMe 1" Grid.Row="0" Grid.Column="0" Margin="0" />
<Button x:Name="ClickMe2" Text="ClickMe 2" Grid.Row="0" Grid.Column="1" Margin="0" />
</Grid>
</Grid>
Screenshot
Button has a default padding.So there will be space always when you try to align buttons together. Either you have to give -ve margin or else instead of button you have to use stacklayout/boxview with gesture for tap commands.
Check this:
<Grid x:Name="controlGrid" ColumnSpacing="0" RowSpacing="0" Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="4*" />
<RowDefinition Height="4*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--Row 2-->
<Grid x:Name="secondGrid" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" ColumnSpacing="0" RowSpacing="0" Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Red" HeightRequest="1" VerticalOptions="End" HorizontalOptions="FillAndExpand" Margin="0" />
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Green" HeightRequest="1" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Blue" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="End" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="0" BackgroundColor="Orange" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="Start" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Crimson" HeightRequest="1" VerticalOptions="End" HorizontalOptions="FillAndExpand" Margin="0" />
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Cyan" HeightRequest="1" VerticalOptions="Start" HorizontalOptions="FillAndExpand" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Blue" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="End" Margin="0"/>
<BoxView Grid.Row="0" Grid.Column="1" BackgroundColor="Orange" WidthRequest="1" VerticalOptions="FillAndExpand" HorizontalOptions="Start" Margin="0"/>
<StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" Margin="1" VerticalOptions="FillAndExpand" BackgroundColor="Gray">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Button1Command}"/>
</StackLayout.GestureRecognizers>
<Label Text="Click Me1" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
</StackLayout>
<StackLayout Grid.Row="0" Grid.Column="1" HorizontalOptions="FillAndExpand" Margin="1" VerticalOptions="FillAndExpand" BackgroundColor="Gray">
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Command="{Binding Button1Command}"/>
</StackLayout.GestureRecognizers>
<Label Text="Click Me2" HorizontalOptions="Center" VerticalOptions="CenterAndExpand"/>
</StackLayout>
</Grid>
</Grid>