Xamarin forms, buttons inside frame are not firing an event - xamarin

I have a form with a frame and 3 buttons inside.
The click event is not firing to any of these buttons.
I put a button outside the frame and its clickable.
The form is from a sample at this page
https://askxammy.com/replicating-user-profile-ui-in-xamarin-forms/.
I asked the author but she didnt respond.
Here is the code.
<ContentPage 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"
x:Class="UserProfileUISample.MainPage">
<Grid BackgroundColor="White">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- 1. Profile picture-->
<Image Grid.Row="0" Source="KattyWhite" VerticalOptions="Start" />
<!-- 2. Contact informaqtion frame-->
<StackLayout Grid.Row="0" BackgroundColor="White" VerticalOptions="End">
<Frame CornerRadius="40" Style="{StaticResource stlMainFrame}" >
<!-- Blocks: 3 and 4 -->
<Grid Padding="25,10,25,0" RowSpacing="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 3. Phone & message buttons-->
<Button x:Name="btn1" Grid.Row="0" Grid.Column="1" Style="{StaticResource stlContactBtn}" HorizontalOptions="End" ImageSource="Phone" Clicked="OnClicked"/>
<Button x:Name="btn2" Grid.Row="0" Grid.Column="2" Style="{StaticResource stlContactBtn}" HorizontalOptions="Start" ImageSource="Correo" Clicked="Button_Clicked_1"/>
<!-- 4. Contact information-->
<Label x:Name="lblName" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Text="Katty White" FontAttributes="Bold" FontSize="20"/>
<Label x:Name="lblCode" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Text="New York" TextColor="#a5a2a2" FontSize="16"/>
<!--<Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" Padding="0,10,0,0" FontSize="16">
<Label.FormattedText>
<FormattedString>
<Span Text="Email: " FontAttributes="Bold" />
<Span Text=" kattywhite#hotmail.com" />
</FormattedString>
</Label.FormattedText>
</Label>-->
<!--4. Contact information: Board inforation-->
<Label Grid.Row="3" Grid.Column="0" Text="Λαχεία" Style="{StaticResource stlBoardTitle}" />
<Label x:Name="lblLaxeia" Grid.Row="4" Grid.Column="0" Text="678" Style="{StaticResource stlBoardDesc}"/>
<Label Grid.Row="3" Grid.Column="1" Text="Γεμίσματα" Style="{StaticResource stlBoardTitle}"/>
<Label x:Name="lblGemismata" Grid.Row="4" Grid.Column="1" Text="340" Style="{StaticResource stlBoardDesc}"/>
<Label Grid.Row="3" Grid.Column="2" Text="Κληρώσεις" Style="{StaticResource stlBoardTitle}"/>
<Label x:Name="lblKliroseis" Grid.Row="4" Grid.Column="2" Text="67k" Style="{StaticResource stlBoardDesc}"/>
<!--4. Contact information: Follow button-->
<Button x:Name="btn3" Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3" TextColor="White" BackgroundColor="#2193f3" Text="Αναλυτικά" Margin="0,20,0,2" FontAttributes="Bold" FontSize="17" HeightRequest="45"/>
</Grid>
</Frame>
<Button x:Name="btn22" Grid.Row="6" Grid.Column="2" Style="{StaticResource stlContactBtn}" HorizontalOptions="Start" ImageSource="Correo" Clicked="Button_Clicked_1"/>
</StackLayout>
</Grid>
Can you help me?
Thank you

When You set TranslationY="-50" property to button,it will make the button out of the bounds of Grid, so it won't response to the click event.
There is a report on the github https://github.com/xamarin/Xamarin.Forms/issues/6760.
I would suggest you to add those buttons or labels directly to Grid and use absolute-layout, relative-layout or other layout to fix their positions.

Related

Parts of UI vanishing when debugging xamarin project on own device

I am building an app, and the debugging works fine when I use the emulator and it all looks the way I want it to.
Because I am using a barcode scanner, I started debugging on my own android device instead, but then most of my UI in one of some of the pages vanishes. (see pics)
I can't find any similar problems when I google (although that might be my poor google skills).
Here is on my device when its all vanished
Here is what it is suppose to look like
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="TergeoAppUI.Views.RegisterInventoryPage"
xmlns:vm="clr-namespace:TergeoAppUI.ViewModels"
xmlns:ZXing="clr-namespace:ZXing.Net.Mobile.Forms;assembly=ZXing.Net.Mobile.Forms" xmlns:model="clr-namespace:Tergeo.Models;assembly=Tergeo.Models"
x:DataType="vm:RegisterInventoryViewModel"
Title="{Binding Title}">
<StackLayout>
<Grid Padding="0,5,0,0" ColumnSpacing="2">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Button
ImageSource="barcode.png"
Text="Scanna"
BackgroundColor="#AAC0AA"
BorderColor="Black"
BorderWidth="3"
HeightRequest="200"
Grid.Row="1"
Grid.Column="2"
Grid.RowSpan="1"
Margin="70,10,10,10"
Command="{Binding GoToScanCommand}"
/>
<Entry
Grid.Row="1"
Grid.ColumnSpan="3"
Margin="20,30,160,5"
Placeholder="EAN, PLU..."
VerticalOptions="FillAndExpand"
Completed="{Binding OnEanEntryCompletionCommand}"
Text="{Binding Ean}"
Keyboard="Numeric"
/>
</Grid>
<Label Margin="30,2" FontSize="Medium" Text="{Binding ArticleName}"/>
<StackLayout HeightRequest="200">
<Grid Padding="2" VerticalOptions="Fill" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label
Grid.Row="1"
Margin="30,2"
FontSize="Medium"
Text="{Binding RetailPrice, StringFormat='Utpris: {0:N}'}"/>
<Entry
Placeholder="Antal"
Grid.Row="2"
Grid.ColumnSpan="2"
Grid.Column='0'
Margin="20,0,20,0"
FontSize="Medium"
Text="{Binding Quantity, StringFormat='Antal: {0:N}'}"/>
<Entry
Grid.ColumnSpan="2"
Margin="0,0,30,0"
Placeholder="Låda"
Grid.Row="2"
Grid.Column="2"
FontSize="Medium"
Text="{Binding Box, StringFormat='Låda: {0:S}'}"
Completed="{Binding OnRegistrationCompletedCommand}"/>
</Grid>
</StackLayout>
<!-- List with all the inventoryregistration for this specific list -->
<ListView
BackgroundColor="White"
ItemsSource="{Binding InventoryList}"
HasUnevenRows="True"
SelectionMode="None"
>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="1" ColumnSpacing="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- ArticleName -->
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="0"
Grid.Row="0">
<Label
TextColor="Black"
FontFamily="PTC55F.ttf#ptc55f"
Text="{Binding ArticleName}"
FontSize="Small"/>
</StackLayout>
<!-- Article Supplier -->
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="1"
Grid.Row="0"
Grid.ColumnSpan="2">
<Label
TextColor="Black"
FontFamily="PTC55F.ttf#ptc55f"
Text="{Binding Supplier}"
FontSize="Small"/>
</StackLayout>
<!-- Article Ean -->
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="0"
Grid.Row="1">
<Label
FontFamily="PTC55F.ttf#ptc55f"
Margin="0,5,0,5"
Text="{Binding Ean}"
FontSize="Small"/>
</StackLayout>
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="0"
Grid.Row="1">
<Label
FontFamily="PTC55F.ttf#ptc55f"
Margin="0,5,0,5"
Text="{Binding Plu}"
FontSize="Small"/>
</StackLayout>
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="1"
Grid.Row="1"
Grid.ColumnSpan="2">
<Label
FontFamily="PTC55F.ttf#ptc55f"
Margin="0,5,0,5"
Text="{Binding Quantity, StringFormat='Antal: {0:N}'}"
FontSize="Small"/>
</StackLayout>
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="4"
Grid.Row="0"
Grid.ColumnSpan="2">
<Label
FontFamily="PTC55F.ttf#ptc55f"
Margin="0,5,0,5"
Text="{Binding Box, StringFormat='Låda: {0:S}'}"
FontSize="Small"/>
</StackLayout>
<StackLayout
Padding="10,0"
x:DataType="model:InventoryInfoModel"
Grid.Column="4"
Grid.Row="1"
Grid.ColumnSpan="2">
<Label
FontFamily="PTC55F.ttf#ptc55f"
Margin="0,5,0,5"
Text="{Binding StorageName, StringFormat='Hyllplats: {0:S}'}"
FontSize="Small"/>
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
Easy fix, apparently the default color on all text is white when you debug on an android device, so all I did was add PlaceholderColor or textcolor to all the labels/entries.

Xamarin, How can i contain the first batch of list of rows and columns with a border, like group them together?

I've been trying to put border on these text and the only way i can is taking off grid on every row so now it has borders but then the grid frame is off. I can't differentiate which part is from row1 or the beginning of list.
<StackLayout>
<Label Text="rain Log" VerticalOptions="Center" HorizontalOptions="Center" Margin="0,50,0,0" />
<ListView x:Name="postListView" >
<ListView.ItemTemplate>
<!-- from the post.cs -->
<DataTemplate>
<ViewCell >
<Grid BackgroundColor="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="FillAndExpand">
<Grid.RowDefinitions > <!-- 8 rows -->
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<!-- Row 1 -->
<Label Grid.Row="1" FontSize="Medium" Grid.Column="0" Text="right tst:" HorizontalTextAlignment="Start" BackgroundColor="cornflowerblue" />
<Label Grid.Column="1" Grid.Row="1" Text="{Binding drain1vol}" BackgroundColor="cornflowerblue"/>
<!-- endrow1 -->
<!-- rain1 Row 1 -->
<Label Grid.Row="2" Grid.Column="0" Text="nothing" BackgroundColor="Yellow"/>
<Label Grid.Row="2" Grid.Column="1" Text="{Binding drain2vol}"
HorizontalTextAlignment="Center" BackgroundColor="Yellow" />
<!-- endrow1 -->
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
what i want
If you want to separate out your item as like group than you can use SeparatorColor and its visibility.
Instead of 2 boxview you can also use one grid as wrapper and using ColumnSpacing and RowSpacing.
<ListView x:Name="postListView" SeparatorVisibility="Default" HasUnevenRows="True" ItemsSource="{Binding Items}" SeparatorColor="White">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid BackgroundColor="Black" HorizontalOptions="CenterAndExpand"
VerticalOptions="FillAndExpand" Padding="1,2,1,0">
<Grid HorizontalOptions="CenterAndExpand"
VerticalOptions="FillAndExpand" ColumnSpacing="1" RowSpacing="1">
<Grid.RowDefinitions >
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" FontSize="Medium" Grid.Column="0" Text="right tst:" HorizontalTextAlignment="Start" BackgroundColor="cornflowerblue" />
<Label Grid.Column="1" Grid.Row="0" Text="{Binding drain1vol}" HorizontalTextAlignment="Center" BackgroundColor="cornflowerblue"/>
<Label Grid.Row="1" Grid.Column="0" Text="nothing" BackgroundColor="Yellow"/>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding drain2vol}" HorizontalTextAlignment="Center" BackgroundColor="Yellow" />
</Grid>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Yes, you can use BoxView to achieve this function, try the following code :
<StackLayout>
<Label Text="rain Log" VerticalOptions="Center" HorizontalOptions="Center" Margin="0,50,0,0" />
<ListView x:Name="postListView" HasUnevenRows="True">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell >
<Grid HorizontalOptions="CenterAndExpand" VerticalOptions="FillAndExpand" ColumnSpacing="2" RowSpacing="0" BackgroundColor="Black">
<Grid.RowDefinitions >
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<Label Grid.Row="0" FontSize="Medium" Grid.Column="0" Text="right tst:" HorizontalTextAlignment="Start" BackgroundColor="cornflowerblue" />
<Label Grid.Column="1" Grid.Row="0" Text="{Binding drain1vol}" HorizontalTextAlignment="Center" BackgroundColor="cornflowerblue"/>
<!-- thin separator -->
<BoxView Color="Black" Grid.Row="0" Grid.ColumnSpan="2" HeightRequest="2" VerticalOptions="End" HorizontalOptions="FillAndExpand" />
<Label Grid.Row="1" Grid.Column="0" Text="nothing" BackgroundColor="Yellow"/>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding drain2vol}" HorizontalTextAlignment="Center" BackgroundColor="Yellow" />
<!-- thick separator -->
<BoxView Color="Black" Grid.Row="3" Grid.ColumnSpan="2" HeightRequest="5" VerticalOptions="End" HorizontalOptions="FillAndExpand" />
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
The effect is as follows:
use a BoxView overlaid on your Grid to simulate a separator
<Grid HorizontalOptions="CenterAndExpand" VerticalOptions="FillAndExpand">
<!-- Row 1 -->
<Label Grid.Row="1" FontSize="Medium" Grid.Column="0" Text="right tst:" HorizontalTextAlignment="Start" BackgroundColor="cornflowerblue" />
<Label Grid.Column="1" Grid.Row="1" Text="{Binding drain1vol}" BackgroundColor="cornflowerblue"/>
<! thin separator -->
<BoxView Color="Black" Grid.Row="1" Grid.ColumnSpan="2" HeightRequest="2" VerticalOptions="End" HorizontalOptions="FillAndExpand" />
<!-- rain1 Row 1 -->
<Label Grid.Row="2" Grid.Column="0" Text="nothing" BackgroundColor="Yellow"/>
<Label Grid.Row="2" Grid.Column="1" Text="{Binding drain2vol}"
HorizontalTextAlignment="Center" BackgroundColor="Yellow" />
<! thick separator -->
<BoxView Color="Black" Grid.Row="2" Grid.ColumnSpan="2" HeightRequest="5" VerticalOptions="End" HorizontalOptions="FillAndExpand" />
</Grid>

How to set the perfect corner radius for the image inside a XfxCardView in xamarin forms?

I have a card view and in that, I have an image. I have to set the corner radius for that image so I'm using frames for doing that.
This is the UI I need and I have marked the Image
This is the result I'm getting
.
This is my code
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="30"
HeightRequest="100" >
<Grid RowSpacing="0">
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Frame CornerRadius="10" Margin="0" Padding="0" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Source="restaurantimage1.jpg" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3"/>
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,0,100,0" BackgroundColor="Aqua" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,0,100,0" BackgroundColor="Green" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,0,100,0" BackgroundColor="LightBlue" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese" TextColor="LightGray"/>
</Grid>
</Grid>
</xfx:XfxCardView>
I have made changes in corner radius and margins but I'm not getting the desired result. Do I have to use something else to do that or should I make any changes in the Frame.
I have done some changes in code so and I'm slightly near to the desired output.
This is the current output
There is still a gap in the frame as you can see I have made changes in the code but still it is not getting fixed. This is my code
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="30"
HeightRequest="100" >
<Grid RowSpacing="0">
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Frame Margin="0" Padding="-40" CornerRadius="25" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,0,100,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,0,100,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,0,100,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese" TextColor="LightGray"/>
</Grid>
</Grid>
</xfx:XfxCardView>
Try setting the is clipped to bounds property as true in your Grid's xaml
<Grid RowSpacing="0" IsClippedToBounds="True">
I fixed it by changing the margin of my frame. This is my code now
<xfx:XfxCardView
BackgroundColor="White"
CornerRadius="30"
Elevation="20"
HeightRequest="150" IsClippedToBounds="True">
<Grid RowSpacing="0" >
<Grid ColumnSpacing="0">
<Grid.RowDefinitions >
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions >
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Frame Margin="10,10,10,20" Padding="-40" CornerRadius="10" Grid.RowSpan="3" BackgroundColor="LightBlue" IsClippedToBounds="True">
<Image Margin="-70,0,0,0" Grid.Row="0" Grid.Column="0" Grid.RowSpan="3" BackgroundColor="AliceBlue" Source="restaurantimage1.jpg" />
</Frame>
<Label Grid.Row="0" Grid.Column="1" Margin="0,30,30,0" HorizontalOptions="Start" Text="Premera restaurant" TextColor="Black" FontFamily="Bold,20"/>
<Image Grid.Row="0" Grid.Column="1" Margin="0,30,10,0" HorizontalOptions="End" Source="whitehearticon3.jpg"/>
<Label Grid.Row="1" Grid.Column="1" Margin="0,-20,40,0" HorizontalTextAlignment="Start" Text="Avenue Road,256" TextColor="Blue"/>
<Label Grid.Row="2" Grid.Column="1" Margin="0,0,40,0" VerticalTextAlignment="Start" Text="Indian,Italy,Chinese Kitchen" TextColor="LightGray"/>
</Grid>
</Grid>
</xfx:XfxCardView>

How to update a DataTemplates (which is a custom view) height and width in xamarin forms?

I have a content view which I will be using as a data template for a custom grid view, which will be supporting horizontal scrolling. And for the custom template I need to fix the width and height request depending on the device width and height. Below is the custom content view. How can i update the width and height request values?
<?xml version="1.0" encoding="UTF-8"?>
<ContentView xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="GridView.BookshelfItem">
<ContentView.Content>
<Grid BackgroundColor="Black" WidthRequest="320">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ProgressBar Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BackgroundColor="#E4E4E4" Progress="{Binding Progress}" HeightRequest="3" VerticalOptions="EndAndExpand"/>
<Image Source="" Aspect="AspectFill" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Grid.RowSpan="3"/>
<Label Text="{Binding Title}" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,0,0" VerticalOptions="End" TextColor="#FFFFFF" FontSize="17"/>
<Image Source="icon.png" Aspect="AspectFill" Grid.Row="1" Grid.Column="1"/>
<StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="10,0,0,0">
<Label Text="{Binding Description}" TextColor="#FFFFFF" FontSize="13"/>
<Label Text="{Binding DescriptionDetails}" TextColor="#FFFFFF" FontSize="15"/>
</StackLayout>
</Grid>
</ContentView.Content>
</ContentView>

xamarin Forms scrollview

I am trying to create a page in Xamarin forms with two columns and five rows.
Both the columns have images with a label at the bottom and a white background. The image and label need to be in the same stack layout.
Basically each stack layout is a thumbnail redirecting to other pages.
Here is what I've tried:
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="0">
<Image Source="My_concern.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Raise A Concern"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="0">
<Image Source="img_leave_plan.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Leave Plan" ></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="1">
<Image Source="My_Checklist.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Leave Plan"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="1">
<Image Source="img_facilities.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Facilities"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="2">
<Image Source="My_buddies.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="My Buddies"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="2">
<Image Source="SapphireArticles.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Articles"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="3">
<Image Source="policy.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Policies"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="3">
<Image Source="SapphireNews.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="News"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="4">
<Image Source="Compass.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Compass"></Label>
</StackLayout>
</StackLayout>
</Grid>
</ScrollView>
I am getting the error
No property, bindable property, or event found for 'Children'.
What am I doing wrong?
Your stacklayout that is the direct child of grid does not have row or column specified. You are specifying it at a level deeper in which grid is not the parent.
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="0">
Also the layout does not looks optimal. You may want to think about refactoring this.
Code without the extra stack layout :
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="0">
<Image Source="My_concern.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Raise A Concern"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="0">
<Image Source="img_leave_plan.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Leave Plan" ></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="1">
<Image Source="My_Checklist.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Leave Plan"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="1">
<Image Source="img_facilities.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Facilities"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="2">
<Image Source="My_buddies.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="My Buddies"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="2">
<Image Source="SapphireArticles.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Articles"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="0" Grid.Row="3">
<Image Source="policy.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Policies"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="3">
<Image Source="SapphireNews.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="News"></Label>
</StackLayout>
<StackLayout BackgroundColor="White" Grid.Column="1" Grid.Row="4">
<Image Source="Compass.png" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand"></Image>
<Label Text="Compass"></Label>
</StackLayout>
</Grid>
</ScrollView>

Resources