I'm building a page in XAML. On this page I want to make the header and footer fixed.
The content will have a scrool and will also have a floating button with the expander.
The code is like this:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms">
<AbsoluteLayout VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- MAIN CONTAINER -->
<Grid Grid.Row="0" RowSpacing="0" BackgroundColor="#e6e6e6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- CUSTOM NAVBAR -->
<Grid Grid.Row="0" BackgroundColor="{DynamicResource DarkAccentColor}" HeightRequest="64">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="40"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="40"/>
</Grid.ColumnDefinitions>
<!-- BACK ICON -->
<ffimageloading:CachedImage Grid.Column="0" HeightRequest="20" WidthRequest="20" Margin="0,0,0,12" VerticalOptions="End" HorizontalOptions="Center" BackgroundColor="Transparent" CacheType="All" FadeAnimationEnabled="false" Opacity="1" Source="{StaticResource BackArrowWhite}" Aspect="AspectFit">
<ffimageloading:CachedImage.GestureRecognizers>
<TapGestureRecognizer Command="{Binding NavigateBackCommand}"/>
</ffimageloading:CachedImage.GestureRecognizers>
</ffimageloading:CachedImage>
<!-- APP NAME -->
<Label Grid.Column="1" VerticalOptions="End" Margin="5,0,0,10" Text="{Binding PageTitle}" FontSize="20" FontAttributes="None" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Center" TextColor="{ DynamicResource BaseTextColor }" />
<!-- SETTINGS ICON -->
<ffimageloading:CachedImage Grid.Column="2" HeightRequest="20" WidthRequest="20" Margin="0,0,10,12" VerticalOptions="End" HorizontalOptions="Center" BackgroundColor="Transparent" CacheType="All" FadeAnimationEnabled="false" Opacity="1" Source="{StaticResource ThreeDotsWhite}" Aspect="AspectFit">
<ffimageloading:CachedImage.GestureRecognizers>
<TapGestureRecognizer Command="{Binding NavigateToSettingsCommand}"/>
</ffimageloading:CachedImage.GestureRecognizers>
</ffimageloading:CachedImage>
</Grid>
<!-- MAIN AREA -->
<ScrollView Grid.Row=1" BackgroundColor="#e6e6e6" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" VerticalOptions="FillAndExpand" Margin="0">
<!-- MAIN GRID -->
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="4" />
<RowDefinition Height="Auto" />
<RowDefinition Height="0" />
<RowDefinition Height="Auto" />
<RowDefinition Height="0" />
<RowDefinition Height="Auto" />
<RowDefinition Height="0" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Expander One -->
<xct:Expander Grid.Row="1" Background="Transparent" ExpandAnimationLength="500" CollapseAnimationLength="500" Padding="10,0,10,10">
<xct:Expander.Header>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent" Padding="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{ StaticResource CollapseUp }" HeightRequest="15" WidthRequest="15" HorizontalOptions="End" VerticalOptions="Start" Margin="5,5,0,0">
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding Source={RelativeSource AncestorType={x:Type xct:Expander}}, Path=IsExpanded}" Value="True">
<Setter Property="Source" Value="{ StaticResource CollapseDown }" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource RobotoMonoRegular}" VerticalOptions="End" Margin="15,0,0,0" Text="Expander One" FontSize="18" FontAttributes="None" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Center" TextColor="{ DynamicResource ServiceOrderInfoValueColor }" />
</Grid>
</xct:Expander.Header>
<xct:Expander.ContentTemplate>
<DataTemplate>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- SEPARATOR -->
<BoxView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Opacity="0.30" Margin="0,10" HeightRequest="0.8" Color="#9B9B9B"/>
</Grid>
</DataTemplate>
</xct:Expander.ContentTemplate>
</xct:Expander>
<!-- Expander Two -->
<xct:Expander Grid.Row="3" Background="Transparent" ExpandAnimationLength="500" CollapseAnimationLength="500" Padding="10,0,10,10">
<xct:Expander.Header>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent" Padding="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{ StaticResource CollapseUp }" HeightRequest="15" WidthRequest="15" HorizontalOptions="End" VerticalOptions="Start" Margin="5,5,0,0">
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding Source={RelativeSource AncestorType={x:Type xct:Expander}}, Path=IsExpanded}" Value="True">
<Setter Property="Source" Value="{ StaticResource CollapseDown }" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource RobotoMonoRegular}" VerticalOptions="End" Margin="15,0,0,0" Text="Expander Two" FontSize="18" FontAttributes="None" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Center" TextColor="{ DynamicResource ServiceOrderInfoValueColor }" />
</Grid>
</xct:Expander.Header>
<xct:Expander.ContentTemplate>
<DataTemplate>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</DataTemplate>
</xct:Expander.ContentTemplate>
</xct:Expander>
<!-- Expander Three -->
<xct:Expander Grid.Row="5" Background="Transparent" ExpandAnimationLength="500" CollapseAnimationLength="500" Padding="10,0,10,10">
<xct:Expander.Header>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent" Padding="0,10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Source="{ StaticResource CollapseUp }" HeightRequest="15" WidthRequest="15" HorizontalOptions="End" VerticalOptions="Start" Margin="5,5,0,0">
<Image.Triggers>
<DataTrigger TargetType="Image" Binding="{Binding Source={RelativeSource AncestorType={x:Type xct:Expander}}, Path=IsExpanded}" Value="True">
<Setter Property="Source" Value="{ StaticResource CollapseDown }" />
</DataTrigger>
</Image.Triggers>
</Image>
<Label Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource RobotoMonoRegular}" VerticalOptions="End" Margin="15,0,0,0" Text="Expander Three" FontSize="18" FontAttributes="None" HorizontalOptions="StartAndExpand" HorizontalTextAlignment="Center" TextColor="{ DynamicResource ServiceOrderInfoValueColor }" />
</Grid>
</xct:Expander.Header>
<xct:Expander.ContentTemplate>
<DataTemplate>
<Grid VerticalOptions="StartAndExpand" BackgroundColor="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- SEPARATOR -->
<BoxView Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Opacity="0.30" Margin="0,10" HeightRequest="0.8" Color="#9B9B9B"/>
</Grid>
</DataTemplate>
</xct:Expander.ContentTemplate>
</xct:Expander>
</Grid>
</ScrollView>
<!-- Footer -->
<Grid Grid.Row="2" BackgroundColor="White" RowSpacing="10" ColumnSpacing="20" Padding="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- YES BUTTON -->
<artina:Button BorderColor="#7b7b7b" BorderWidth="1" Grid.Column="0" Grid.Row="0" FontFamily="{StaticResource RobotoMonoBold}" Margin="15" FontSize="14" FontAttributes="Bold" Style="{StaticResource RatButtonStylePrevious}" VerticalOptions="EndAndExpand" Text="Back" WidthRequest="160" Command="{Binding ToBack}"/>
<!-- NO BUTTON-->
<artina:Button Grid.Column="1" Grid.Row="0" FontFamily="{StaticResource RobotoMonoBold}" Margin="15" FontSize="14" FontAttributes="Bold" Style="{StaticResource RatButtonStyleNext}" VerticalOptions="EndAndExpand" Text="Next" WidthRequest="160" Command="{Binding ToNext}"/>
</Grid>
</Grid>
</Grid>
<!-- Floating expander -->
<Frame CornerRadius="30"
Padding="15"
Margin="0,0,15,40"
HorizontalOptions="End"
AbsoluteLayout.LayoutFlags="PositionProportional"
AbsoluteLayout.LayoutBounds="1, 1, AutoSize, AutoSize"
VerticalOptions="End">
<xct:Expander Rotation="180">
<xct:Expander.Header>
<Label
Style="{StaticResource LabelStyle}"
Text="Item">
<Label.Triggers>
<DataTrigger
Binding="{Binding Source={RelativeSource AncestorType={x:Type xct:Expander}}, Path=IsExpanded}"
TargetType="Label" Value="True">
<Setter Property="Text" Value="a" />
</DataTrigger>
</Label.Triggers>
</Label>
</xct:Expander.Header>
<StackLayout>
<Label Style="{StaticResource LabelStyle}"
Text="01" />
<Label Style="{StaticResource LabelStyle}"
Text="02" />
<Label Style="{StaticResource LabelStyle}"
Text="03" />
</StackLayout>
</xct:Expander>
</Frame>
</AbsoluteLayout>
</ContentPage>
But I'm not able to make the footer fixed, there is always some conflict with my floating expander
CollectionView Headers and Footers are not designed with the idea that they are supposed to stick to a particular area of the screen they are like screen the header and the footer of your list so if it contracts they come close to each other with it.
But if you want a View that sticks to the bottom of the screen regardless of what you add to it just use a Grid to do this instead.
<Grid RowDefinitions="Auto,*,Auto">
<StackLayout Grid.Row="0" >
<!--Whatever view you wanna display...-->
</StackLayout>
<CollectionView Grid.Row= "1">
......
</CollectionView >
<StackLayout Grid.Row="2" >
<!--Whatever view you wanna display...-->
</StackLayout>
</Grid>
Hope this helps,
Feel free to ask me if you have queries
Related
I have an issue with a component on my MAUI application:
When i load the page that the component (a bar) is shown appears like this:
Image on loading
But, when i touch the size of my windows, the layout fix immediatly.
Image after windows resize
This is the xaml of the page that contains the bar:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:res="clr-namespace:APEEvo.Mobile.Resources"
xmlns:components="clr-namespace:APEEvo.Mobile.Components"
x:Class="APEEvo.Mobile.ReturnFileSearch.ReturnFileDetailPage"
Loaded="ContentPage_Loaded">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0" Grid.ColumnSpan="2">
<components:InfoBar x:Name="infoBar" VerticalOptions="Start"/>
</StackLayout>
<StackLayout Grid.Row="1" Grid.ColumnSpan="2" Margin="0,0,0,30">
<components:ReturnFileBar x:Name="ReturnFileBar" VerticalOptions="Center"/>
</StackLayout>
<HorizontalStackLayout Grid.Row="2" Grid.ColumnSpan="2" >
<Label Text="{x:Static res:UIStrings.Article}" HorizontalOptions="Start" Margin="10,0" Style="{StaticResource TopDetailPageLabel}"/>
<components:BarcodeScanner x:Name="barcodeScanner" BackgroundColor="{StaticResource TertiaryAccent}" HorizontalOptions="Start" VerticalOptions="Center" ButtonVisible="true" Caption="{x:Static res:UIStrings.ArticleBarcode}" Margin="20,0"/>
<Button x:Name="buttonNavigation" HorizontalOptions="Start" VerticalOptions="Center" Text="Test" Margin="20,0" Clicked="ButtonNavigation_Clicked"/>
</HorizontalStackLayout>
<StackLayout Grid.Row="3" Grid.ColumnSpan="2" Padding="30" >
<components:OutcomeSummary x:Name="grpOutcomes" HeightRequest="450"/>
</StackLayout>
</Grid>
</ScrollView>
</ContentPage>
And this the xaml of the component:
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:res="clr-namespace:APEEvo.Mobile.Resources"
x:Class="APEEvo.Mobile.Components.ReturnFileBar">
<Grid x:Name="grdFileDetailBar" BackgroundColor="{StaticResource PrimaryBarColor}">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Column="0" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{x:Static res:UIStrings.Return}" Style="{StaticResource TopReturnFileLabel}" HorizontalOptions="Center" VerticalOptions="Center" Margin="0,0,5,0" />
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2" />
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="1" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.Key}" />
<Label x:Name="txtKey" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="2" Margin="5,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.Date}" />
<Label x:Name="txtDateOfWhat" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="3"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="3" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.Type}" />
<Label x:Name="txtType" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="4" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.Reason}" />
<Label x:Name="txtReason" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="5" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.ReconditionType}" />
<Label x:Name="txtRecondition" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="6" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.SAPInboundDelivery}" />
<Label x:Name="txtSapInbound" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="7" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.IctReference}" />
<Label x:Name="txtIctReference" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
<Line Grid.Column="1" Stroke="White" Y1="0" Y2="50" StrokeDashArray="4,4" StrokeDashOffset="2"/>
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="8" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label Style="{StaticResource DetailOutcomeLabelTitle}" Text="{x:Static res:UIStrings.NPcs}" />
<Label x:Name="txtNPcs" Style="{StaticResource DetailOutcomeLabelValue}" />
</VerticalStackLayout>
</Grid>
</HorizontalStackLayout>
</Grid>
</Grid>
</ContentView>
Can you help me?
"nested layouts" with auto-sizing are sometimes difficult for layout manager to figure out correctly. You can greatly simplify the XAML of your component.
Original:
<Grid x:Name="grdFileDetailBar" BackgroundColor="{StaticResource PrimaryBarColor}">
<Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions>
<Grid >
<Grid.ColumnDefinitions> ...9 Autos... </Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Column="0" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions> ...2 Autos... </Grid.ColumnDefinitions>
<Label Grid.Column="0" ... />
<Line Grid.Column="1" ... />
</Grid>
</HorizontalStackLayout>
<HorizontalStackLayout Grid.Column="1" Margin="5,0" >
<Grid>
<Grid.ColumnDefinitions> ...2 Autos... </Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label ... />
<Label x:Name="txtKey" ... />
</VerticalStackLayout>
<Line Grid.Column="1" ... />
</Grid>
</HorizontalStackLayout>
... more elements ...
</Grid>
</Grid>
Simplified:
<Grid x:Name="grdFileDetailBar" BackgroundColor="{StaticResource PrimaryBarColor}">
<Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> ...9 Autos... </Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5,0">
<Grid.ColumnDefinitions> ...2 Autos... </Grid.ColumnDefinitions>
<Label Grid.Column="0" ... />
<Line Grid.Column="1" ... />
</Grid>
<Grid Grid.Column="1" Margin="5,0">
<Grid.ColumnDefinitions> ...2 Autos... </Grid.ColumnDefinitions>
<VerticalStackLayout Grid.Column="0" Margin="0,0,5,0" VerticalOptions="Center" >
<Label ... />
<Label x:Name="txtKey" ... />
</VerticalStackLayout>
<Line Grid.Column="1" ... />
</Grid>
... more elements ...
</Grid>
Removed from above: One layer of grid; VerticalStackLayouts that served no purpose, as they only contained a single Grid each.
Does this work better?
[OPTIONAL] Flattened:
If above doesn't work, try to "flatten" into a single Grid (below will need tweaking of margins):
<Grid x:Name="grdFileDetailBar" BackgroundColor="{StaticResource PrimaryBarColor}">
<Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> ...many Autos... </Grid.ColumnDefinitions>
<Label Grid.Column="0" ... Margin="5,0" />
<Line Grid.Column="1" ... Margin="5,0" />
<VerticalStackLayout Grid.Column="3" Margin="0,0,5,0" VerticalOptions="Center" >
<Label ... />
<Label x:Name="txtKey" ... />
</VerticalStackLayout>
<Line Grid.Column="4" ... />
... more elements ...
</Grid>
ALTERNATIVE TECHNIQUE:
Adding explicit WidthRequest="NN"s, where "NN" is some number, will fix most layout issues. Obviously this hardcodes those widths, so is less desireable. But sometimes it is the only way.
Please see below image
please see below code
//PopUp.Xaml
<ListView.Header>
<Frame>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30*" />
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="20*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Grid.Row="0" Text="Product"
HorizontalOptions="Center"/>
<Label Grid.Column="1" Grid.Row="0"
Text="Quantity"
HorizontalOptions="Center"/>
<Label Grid.Column="2" Grid.Row="0"
Text="Price"
HorizontalOptions="Center"/>
<Label Grid.Column="3" Grid.Row="0"
Text="Sub"
HorizontalOptions="Center"/>
<BoxView Grid.Row="1"
Grid.ColumnSpan="4"
HeightRequest="1"
BackgroundColor="LightGray"/>
</Grid>
</Frame>
</ListView.Header>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10" RowSpacing="10" ColumnSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="43*" />
<ColumnDefinition Width="8*" />
<ColumnDefinition Width="25*" />
<ColumnDefinition Width="24*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0" Text="{Binding OrderModel_Id}" VerticalOptions="End"/>
<Label Grid.Column="1" Grid.Row="0" Text="{Binding User_Name}" VerticalOptions="End"/>
<Label Grid.Column="0" Grid.Row="0" HorizontalOptions="StartAndExpand" VerticalOptions="StartAndExpand" Text="{Binding Product_Id, Converter={StaticResource converter}}"/>
<Label Grid.Column="1" Grid.Row="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Text="{Binding Quantity}"/>
<Label Grid.Column="2" Grid.Row="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Text="{Binding PriceOf_Item, StringFormat='£{0:0.00}'}"/>
<Label Grid.Column="3" Grid.Row="0" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand" Text="{Binding SubtotalForThis_Item, StringFormat='£{0:0.00}'}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</pages:PopupPage>
My Q being why does the popUp header of the listview...appear with a bold border below it? only on ios...not on android...I would like to remove it please. does anyone know how?
I have created both a DatePicker and a TimePicker, but what I see is only the underlining, while the text always appears transparent, I cannot read it. It is still clickable but not readable
<yummy:PancakeView x:Name="CreatePageDiary" IsVisible="False" Grid.Row="1" CornerRadius="15,15,0,0" BackgroundColor="LightBlue" VerticalOptions="FillAndExpand">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<BoxView BackgroundColor="Blue" Grid.Row="0"/>
<BoxView BackgroundColor="Green" Grid.Row="1"/>
<Grid Margin="15" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="15"/>
<RowDefinition Height="15"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<BoxView CornerRadius="100" Grid.Row="0" Grid.RowSpan="2" Grid.Column="4" HorizontalOptions="End" WidthRequest="40">
<BoxView.Background>
<LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
<GradientStop Color="Blue" Offset="0" />
<GradientStop Color="LightBlue" Offset="1.0" />
</LinearGradientBrush>
</BoxView.Background>
</BoxView>
<BoxView x:Name="BVGrayDiary" CornerRadius="100" Grid.Row="0" Grid.RowSpan="2" Grid.Column="4" HorizontalOptions="End" WidthRequest="40" BackgroundColor="Gray"/>
<Image Source="checked.png" Grid.Row="0" Grid.RowSpan="2" Grid.Column="4" HorizontalOptions="End" HeightRequest="20" Margin="0,0,10,0"/>
<Button x:Name="BTSaveDiary" IsVisible="False" BackgroundColor="Transparent" Grid.Row="0" Grid.RowSpan="2" Grid.Column="4" HorizontalOptions="End" HeightRequest="25" Clicked="BTSaveDiary_Clicked"/>
<Grid Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" HorizontalOptions="End" BackgroundColor="Transparent" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="calendardataPicker"/>
<DatePicker Grid.Column="1" x:Name="DataPicker" TextColor="Blue"/>
<DatePicker Grid.Column="1" x:Name="DataPickerVisual" Visual="Material" Opacity="0"/>
</Grid>
<StackLayout Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" HorizontalOptions="Center" Orientation="Horizontal" >
<Image Source="clockTimePicker"/>
<TimePicker x:Name="TimePicker" TextColor="Blue"/>
</StackLayout>
//other code
but what I see is only the underlining, while the text always appears transparent, I cannot read it. It is still clickable but not readable.
From your screenshot, I guess that you set the same color for contentpage's backgroundcolor and DatePicker and TimePicker TextColor, so you can not see the text.
Don't see TextColor or set other color for DatePicker and TimePicker.
<StackLayout BackgroundColor="Green">
<DatePicker TextColor="Red"></DatePicker>
<TimePicker TextColor="Red"></TimePicker>
</StackLayout>
Update
From your code, I don't have yummy:PancakeView, so I use frame to replace yummy:PancakeView.
Please set the second Grid RowDefinition Height="Auto" or higher, then DatePicker and TimePicker will display correctly.
<Frame
x:Name="CreatePageDiary"
CornerRadius="15"
VerticalOptions="FillAndExpand">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="5" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<BoxView Grid.Row="0" BackgroundColor="Blue" />
<BoxView Grid.Row="1" BackgroundColor="Green" />
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<BoxView
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="4"
CornerRadius="100"
HorizontalOptions="End"
WidthRequest="40">
<BoxView.Background>
<LinearGradientBrush StartPoint="1,0" EndPoint="1,1">
<GradientStop Offset="0" Color="Blue" />
<GradientStop Offset="1.0" Color="LightBlue" />
</LinearGradientBrush>
</BoxView.Background>
</BoxView>
<BoxView
x:Name="BVGrayDiary"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="4"
BackgroundColor="Gray"
CornerRadius="100"
HorizontalOptions="End"
WidthRequest="40" />
<Image
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="4"
Margin="0,0,10,0"
HeightRequest="20"
HorizontalOptions="End"
Source="check.png" />
<Button
x:Name="BTSaveDiary"
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="4"
BackgroundColor="Transparent"
HeightRequest="25"
HorizontalOptions="End"
Text="test" />
<Grid
Grid.Row="0"
Grid.Column="1"
Grid.ColumnSpan="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="15" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.Column="0" Source="favorite.png" />
<DatePicker
x:Name="DataPicker"
Grid.Column="1"
Date="06/21/2018"
TextColor="Blue" />
<DatePicker
x:Name="DataPickerVisual"
Grid.Column="1"
Opacity="0"
Visual="Material" />
</Grid>
<StackLayout
Grid.Row="1"
Grid.Column="1"
Grid.ColumnSpan="3"
HorizontalOptions="Center"
Orientation="Horizontal">
<Image Source="favorite.png" />
<TimePicker x:Name="TimePicker" TextColor="Blue" />
</StackLayout>
</Grid>
</Grid>
</Frame>
The screen that I test:
I've been stuck in this programming problem for a while now. I've designed a screen just like this in my Xamarin.Forms application. the part I'm stuck is centering the CollectionView which is the part in the screen where it stacks the months. I've tried using Margin but it's not the best solution because it will show different in each screen. I've tried messing with StackLayout and setting its HorizontalOptions to Center/Expand didn't work. Even when I directly set the CollectionView to Center/Expand the content of the CollectionView will still be in the "Start" align of the screen. I'm so clueless here, no idea what I'm doing wrong here. Note that this control is stacked inside a Grid.Row within the main Grid.
XAML is pasted here
<?xml version="1.0" encoding="utf-8" ?>
<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"
xmlns:converters="clr-namespace:Covid19Tracker.Converters;assembly=Covid19Tracker"
xmlns:i18n="clr-namespace:Covid19Tracker.Common;assembly=Covid19Tracker"
xmlns:chart1="clr-namespace:Telerik.XamarinForms.Chart;assembly=Telerik.XamarinForms.Chart"
mc:Ignorable="d"
FlowDirection="{x:Static Device.FlowDirection}"
BackgroundColor="#0c0e28"
NavigationPage.HasNavigationBar="False"
x:Class="Covid19Tracker.Views.MainView">
<ContentPage.Resources>
<ResourceDictionary>
<converters:FlowDirectionConverter x:Key="FlowDirectionConverter"/>
<converters:ListMarginConverter x:Key="MarginConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<RefreshView IsRefreshing="{Binding IsBusy, Mode=OneWay}" Command="{Binding RefreshCommand}">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--Topbar-->
<Grid Padding="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" HeightRequest="22" WidthRequest="22" Source="menu.png"/>
<Label Grid.Column="1" Margin="30,0,0,0" FontSize="24" Text="{i18n:Translate TopbarLabel}"/>
<StackLayout Grid.Column="2" Orientation="Horizontal" HorizontalOptions="EndAndExpand">
<Image HeightRequest="22" WidthRequest="22" Source="search.png"/>
<Image Margin="20,0,0,0" HeightRequest="22" WidthRequest="22" Source="options.png"/>
</StackLayout>
</Grid>
<!--Topbar-->
<!--Graph-->
<chart1:RadCartesianChart Grid.Row="1" HeightRequest="150" BackgroundColor="Transparent">
<chart1:RadCartesianChart.HorizontalAxis>
<chart1:CategoricalAxis MajorTickBackgroundColor="Transparent"
LabelTextColor="Transparent"
LineColor="Transparent"
LabelFitMode="MultiLine"
PlotMode="OnTicks" />
</chart1:RadCartesianChart.HorizontalAxis>
<chart1:RadCartesianChart.VerticalAxis>
<chart1:NumericalAxis MajorTickBackgroundColor="Transparent"
LineColor="Transparent"
LabelTextColor="Transparent"/>
</chart1:RadCartesianChart.VerticalAxis>
<chart1:RadCartesianChart.Series>
<chart1:SplineSeries
Stroke="#e32049"
ValueBinding="Value"
ItemsSource="{Binding InfectionHistory}"/>
<chart1:SplineSeries
Stroke="#2979ff"
ValueBinding="Value"
ItemsSource="{Binding RecoveredHistory}"/>
</chart1:RadCartesianChart.Series>
</chart1:RadCartesianChart>
<!--Graph-->
<!--Statistics-->
<Grid Grid.Row="2" Margin="15" HorizontalOptions="CenterAndExpand">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0" Margin="20,0,0,0">
<Label HorizontalTextAlignment="{Binding Converter={StaticResource FlowDirectionConverter}}" FontSize="Large" Text="{Binding Recovered, StringFormat='{}{0:0,0}'}"/>
<Label FontSize="Medium" Text="{i18n:Translate txtRecovering}" TextColor="#2979ff"/>
</StackLayout>
<BoxView Grid.Row="1" Grid.Column="0" Margin="0,15,0,0" Color="#2979ff" HeightRequest="1" WidthRequest="180"/>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackLayout Grid.Row="0" Margin="20,0,0,0">
<Label HorizontalTextAlignment="{Binding Converter={StaticResource FlowDirectionConverter}}" FontSize="Large" Text="{Binding Infected, StringFormat='{}{0:0,0}'}"/>
<Label FontSize="Medium" Text="{i18n:Translate txtInfections}" TextColor="#e32049"/>
</StackLayout>
<BoxView Grid.Row="1" Grid.Column="0" Margin="0,15,0,0" Color="#e32049" HeightRequest="1" WidthRequest="180" />
</Grid>
</Grid>
<!--Statistics-->
<!--Extended details-->
<CollectionView
x:Name="CollectionView"
Grid.Row="3"
SelectionMode="Single"
SelectionChangedCommand="{Binding SelectionChangedCommand}"
SelectionChangedCommandParameter="{Binding SelectedItem, Source={x:Reference CollectionView}}"
Margin="0,10,0,30"
ItemsSource="{Binding MonthModels}"
HeightRequest="30">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Horizontal" ItemSpacing="70"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CommonStates">
<VisualState Name="Selected">
<VisualState.Setters>
<Setter Property="BackgroundColor" Value="#0c0e28" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Label FontSize="Large" Text="{Binding MonthLabel}">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="CommonStates">
<VisualState Name="Normal">
<VisualState.Setters>
<Setter Property="TextColor" Value="#4f516e"></Setter>
</VisualState.Setters>
</VisualState>
<VisualState Name="Selected">
<VisualState.Setters>
<Setter Property="TextColor" Value="White" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Label>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<ListView
Grid.Row="4"
SeparatorVisibility="Default"
SeparatorColor="#232539"
HasUnevenRows="True"
HeightRequest="350"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
x:Name="ListView"
x:FieldModifier="public"
ItemsSource="{Binding ListViewItems}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="20">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label TextColor="White" Margin="{Binding Converter={StaticResource MarginConverter}}" Text="{Binding date, StringFormat='{}{0:MMMM dd}'}" />
<StackLayout Orientation="Horizontal" Grid.Column="1">
<Image Margin="0,0,6,0" WidthRequest="6" HeightRequest="6" Source="BluePoly.png"/>
<Label TextColor="#2774f5" Text="{Binding recovered, StringFormat='{}{0:0,0}'}" />
</StackLayout>
<StackLayout Orientation="Horizontal" Grid.Column="2">
<Image Margin="0,0,6,0" WidthRequest="6" HeightRequest="6" Source="RedPoly.png"/>
<Label TextColor="#e32049" Text="{Binding infected, StringFormat='{}{0:0,0}'}" />
</StackLayout>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!--Extended details-->
</Grid>
</ScrollView>
</RefreshView>
</ContentPage.Content>
</ContentPage>
I hope I filed this question properly in order to get serious help and not "read FAQ"
You could add an extra Column both on left and right of the label .
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*" />
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="0.1*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="1" FontSize="Large" Text="{Binding MonthLabel}" HorizontalTextAlignment="Center" >
Now the label will display on the center of screen
Update
You can also put the whole CollectionView in the second
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*" />
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="0.1*" />
</Grid.ColumnDefinitions>
<!--Extended details-->
<CollectionView
Grid.Column="1"
//...>
//...
</CollectionView>
</Grid>
This is how I solved Collection centering. You'll find it here:
How to centre CollectionView items?
I have a grid view and I want to add a button in bottom of my screen
I have used following code:
[![enter image description here][1]][1]
<Grid>[![enter image description here][2]][2]
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="88*"/>
<RowDefinition Height="12*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0" BackgroundColor="White">
<Grid Grid.Column="1" Grid.Row="0" BackgroundColor="White">
<Grid Grid.Row="1" BackgroundColor="#f24245" HorizontalOptions="FillAndExpand">
<Button Text="Lookupjshgkdfjghkdjfghdkjfhgdlfkjghfk" HorizontalOptions="FillAndExpand" TextColor="White" FontSize="Large" BackgroundColor="#f24245"/>
</Grid>
</Grid>
[1]: https://i.stack.imgur.com/vsEn9.png
[2]: https://i.stack.imgur.com/TazCg.png
Please Add Grid.ColumnSpan="2" Like,
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="88*"/>
<RowDefinition Height="12*"/>
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0" BackgroundColor="White">
<!--Place you code Here-->
</Grid>
<Grid Grid.Column="1" Grid.Row="0" BackgroundColor="White">
<!--Place you code Here-->
</Grid>
<Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" BackgroundColor="#f24245" HorizontalOptions="FillAndExpand">
<Button Text="Lookupjshgkdfjghkdjfghdkjfhgdlfkjghfk" HorizontalOptions="FillAndExpand" TextColor="White" FontSize="Large" BackgroundColor="#f24245"/>
</Grid>
</Grid>
Use VerticalOptions="End"
Example:
<Grid Padding="20" RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="0.7*" />
<RowDefinition Height="0.3*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- row 0 -->
<Image Grid.Row="0" Source="icon-76.png" WidthRequest="150" HeightRequest="150" />
<!-- row 1 -->
<StackLayout Grid.Row="2" VerticalOptions="End">
<Button Margin="0,5,0,5" Text="Button at the bottom" BackgroundColor="#4a4acd" TextColor="White" FontAttributes="Bold" />
</StackLayout>
</Grid>
This will give you the following view: