Events on elements in Relative Layout not firing - xaml

I am using Xamarin Forms and events on elements inside of a relative layout are not firing. I tried to register them in code behind as well and still not firing. I have -250 constraint on it because buttons were showing up on the bottom of the screen and it was the only way I could move them up.
Here is my xaml:
<StackLayout Orientation="Vertical">
<RelativeLayout>
<Grid Margin="0,0,10,0"
x:Name="grid"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=10}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=0}"
>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Grid.Row="0"
Text="IP Address"
Margin="10,10,0,0"
HorizontalOptions="StartAndExpand"/>
<Entry Grid.Column="1"
Grid.Row="0"
x:Name="IPAddress"
Placeholder="IP"
WidthRequest="200"
Margin="0,0,10,0"
HorizontalOptions="EndAndExpand"/>
<Label Grid.Column="0"
Grid.Row="1"
Text="Port"
Margin="10,10,0,0"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="1"
x:Name="Port"
Margin="0,0,10,0"
Placeholder="Port"
WidthRequest="200"
HorizontalOptions="End"/>
<Label Grid.Column="0"
Grid.Row="2"
Margin="10,10,0,0"
Text="User Name"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="2"
x:Name="UserName"
Margin="0,0,10,0"
WidthRequest="200"
Placeholder="User Name"
HorizontalOptions="End"/>
<Label Grid.Column="0"
Grid.Row="3"
Margin="10,10,0,0"
Text="Password"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="3"
x:Name="Password"
IsPassword="True"
Margin="0,0,10,0"
WidthRequest="200"
Placeholder="Password"
HorizontalOptions="End"/>
</Grid>
</RelativeLayout>
<RelativeLayout
IsEnabled="True">
<Button x:Name="SaveBtn"
IsEnabled="True"
WidthRequest="100"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=-250}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=30}"
Clicked="SaveBtn_Clicked"
BorderColor="Gray"
Text="Save"></Button>
<Button x:Name="ClearFavorites"
IsEnabled="True"
WidthRequest="120"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=-250}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5, Constant=20}"
Clicked="ClearFavorites_Clicked"
BorderColor="Gray"
Text="Clear Favorites"></Button>
</RelativeLayout>
</StackLayout>

After discussion on chat this seems to work
<StackLayout Orientation="Vertical">
<RelativeLayout>
<Grid Margin="0,0,10,0"
x:Name="grid"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=10}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=0}"
>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50*" />
<ColumnDefinition Width="50*" />
</Grid.ColumnDefinitions>
<Label Grid.Column="0"
Grid.Row="0"
Text="IP Address"
Margin="10,10,0,0"
HorizontalOptions="StartAndExpand"/>
<Entry Grid.Column="1"
Grid.Row="0"
x:Name="IPAddress"
Placeholder="IP"
WidthRequest="200"
Margin="0,0,10,0"
HorizontalOptions="EndAndExpand"/>
<Label Grid.Column="0"
Grid.Row="1"
Text="Port"
Margin="10,10,0,0"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="1"
x:Name="Port"
Margin="0,0,10,0"
Placeholder="Port"
WidthRequest="200"
HorizontalOptions="End"/>
<Label Grid.Column="0"
Grid.Row="2"
Margin="10,10,0,0"
Text="User Name"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="2"
x:Name="UserName"
Margin="0,0,10,0"
WidthRequest="200"
Placeholder="User Name"
HorizontalOptions="End"/>
<Label Grid.Column="0"
Grid.Row="3"
Margin="10,10,0,0"
Text="Password"
MinimumWidthRequest="100"
HorizontalOptions="Start"/>
<Entry Grid.Column="1"
Grid.Row="3"
x:Name="Password"
IsPassword="True"
Margin="0,0,10,0"
WidthRequest="200"
Placeholder="Password"
HorizontalOptions="End"/>
</Grid>
</RelativeLayout>
<RelativeLayout
IsEnabled="True">
<Button x:Name="SaveBtn"
IsEnabled="True"
WidthRequest="100"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=50}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=0, Constant=30}"
Clicked="SaveBtn_Clicked"
BorderColor="Gray"
Text="Save"></Button>
<Button x:Name="ClearFavorites"
IsEnabled="True"
WidthRequest="120"
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Y, Factor=0, Constant=50}"
RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=0.5, Constant=20}"
Clicked="ClearFavorites_Clicked"
BorderColor="Gray"
Text="Clear Favorites"></Button>
</RelativeLayout>
</StackLayout>

Related

In a Grid with value of Auto I cannot see the contents of the Label

In the DataTemplate of a CollectionView I have a Grid, and inside it a Row to which I insert the Height value in Auto. I associate a Label with that Row, but it is not displayed, while if I insert an absolute value in the Row then the text is visible. How could I solve?
<CollectionView
RelativeLayout.YConstraint="{ConstraintExpression
Type=Constant,
Constant=140}"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1}"
Margin="10,0">
<CollectionView.ItemsLayout>
<LinearItemsLayout Orientation="Vertical" ItemSpacing="9"/>
</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>
<DataTemplate>
<yummy:PancakeView CornerRadius="5">
<RelativeLayout>
<Grid BackgroundColor="LightGray" RowSpacing="0.2">
<Grid.RowDefinitions>
<RowDefinition Height="1"/>
<RowDefinition Height="16"/>
<RowDefinition Height="16"/>
<RowDefinition Height="25"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="65"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<BoxView Grid.ColumnSpan="2" Grid.Row="0" BackgroundColor="{Binding ColoreUmore}"/>
<Image Grid.Row="1" Grid.RowSpan="3" Grid.Column="0" Margin="8" Source="{Binding Umore}" VerticalOptions="Start"/>
<Label Grid.Row="1" Grid.Column="1" Text="{Binding GiornoTrascritto}" FontSize="14" TextColor="Black" Opacity="0.7" />
<Label Grid.Row="2" Grid.Column="1" Text="{Binding Orario}" FontSize="14" TextColor="Black" Opacity="0.7" />
<Label Grid.Row="3" Grid.Column="1" Text="{Binding DescrizioneUmore}" FontSize="16" TextColor="{Binding ColoreUmore}" HorizontalTextAlignment="Start"/>
<FlexLayout
Grid.Row="4"
Margin="0,5,10,0"
Grid.Column="1"
BindableLayout.ItemsSource="{Binding IconDiaries}"
Wrap="Wrap"
JustifyContent="Start"
Direction="Row"
AlignItems="Start"
AlignContent="Start">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Grid Padding="0,2,3,0">
<Grid.RowDefinitions>
<RowDefinition Height="17"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="18"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<BoxView BackgroundColor="Black" Opacity="0.4" Grid.ColumnSpan="2" Grid.Row="0" CornerRadius="5" />
<Image Grid.Row="0" Grid.Column="0" Source="{Binding isSource}" Margin="3"/>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding id}" TextColor="{Binding ColoreUmore}" FontSize="12" VerticalTextAlignment="Center" Margin="0,0,3,0"/>
</Grid>
</DataTemplate>
</BindableLayout.ItemTemplate>
</FlexLayout>
<BoxView Grid.Row="5" Grid.Column="1" CornerRadius="7" BackgroundColor="Black" Opacity="0.2" Margin="0,0,4,4"/>
THIS-----> <Label Grid.Row="5" Grid.Column="1" TextColor="White" FontSize="16" Text="{Binding Nota}" Margin="5,0,9,0" />
<Image Source="rightArrowB" Grid.Row="1" Grid.Column="1" HorizontalOptions="End" Margin="0,0,10,0" Rotation="90" Opacity="0.4"/>
<Button Grid.Row="1" Grid.Column="1" WidthRequest="70" HeightRequest="21" BackgroundColor="Transparent" Clicked="BtOperazioni"/>
</Grid>
<StackLayout
RelativeLayout.YConstraint="{ConstraintExpression
Type=Constant,
Constant=8}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=Constant,
Constant=200}"
HeightRequest="72"
WidthRequest="90"
IsVisible="{Binding Edit}">
<Button Text="Modifica" BackgroundColor="Blue" Opacity="0.9" CornerRadius="5" TextColor="White" HeightRequest="37" />
<Button Text="Elimina" BackgroundColor="Blue" Opacity="0.9" CornerRadius="5" TextColor="White" Clicked="EliminaDiario" HeightRequest="37" />
</StackLayout>
</RelativeLayout>
</yummy:PancakeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>

Free space using FillAndExpand

Im' working on XAML view and I want to create simple view with left side bar and the content with Grid and inside grid I have some buttons, that I want to achieve is to fill all form
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"
xmlns:local="clr-namespace:App.ViewModels"
mc:Ignorable="d"
x:Class="App.Views.UserSelectionPage">
<ContentPage.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="FillAndExpand">
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Vertical" BackgroundColor="#093145" HorizontalOptions="Start" VerticalOptions="FillAndExpand" >
<Label Text="AppName"
Grid.Row="0"
Grid.Column="1"
HorizontalOptions="Center"
VerticalOptions="Center"
FontSize="Header"
TextColor="White"
Margin="15,0,10,15" />
</StackLayout>
<StackLayout Orientation="Vertical" VerticalOptions="End" BackgroundColor="#093145">
<Image Source="Assets/LargeTitle.scale-100.png"
Grid.Row="0"
Grid.Column="0"
HorizontalOptions="Center"
WidthRequest="90"
HeightRequest="90"
Margin="15,0,10,15"
VerticalOptions="Center"/>
</StackLayout>
</StackLayout>
<Grid BackgroundColor="AliceBlue">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!--<BoxView Color="#505CA9" Grid.Row="0" Grid.ColumnSpan="3" />-->
<Button Text="Use username instead"
Command="{Binding ToggleNewUserCommand}"
Grid.Row="0"
Grid.Column="2"
VerticalOptions="Center"
HorizontalOptions="End"
BackgroundColor="Transparent"
FontSize="Title"
TextColor="White"
Margin="15,0,10,15"/>
<Button x:Name="userOne"
d:Text="GQ"
Text="{Binding UserSelectionList[0].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userOne}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="0"
BackgroundColor="{Binding UserSelectionList[0].BackgroundColor}"
d:BackgroundColor="#093145"/>
<Button x:Name="userTwo"
d:Text="LR"
Text="{Binding UserSelectionList[1].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userTwo}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="1"
BackgroundColor="{Binding UserSelectionList[1].BackgroundColor}"
d:BackgroundColor="#107896" />
<Button x:Name="userThree"
d:Text="AR"
Text="{Binding UserSelectionList[2].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userThree}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Margin="0,40,0,40"
Grid.Row="1"
Grid.Column="2"
BackgroundColor="{Binding UserSelectionList[2].BackgroundColor}"
d:BackgroundColor="#829356" />
<Button x:Name="userFour"
d:Text="RR"
Text="{Binding UserSelectionList[3].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userFour}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="0"
BackgroundColor="{Binding UserSelectionList[3].BackgroundColor}"
d:BackgroundColor="#EBC944" />
<Button x:Name="userFive"
d:Text="GQ"
Text="{Binding UserSelectionList[4].Abbreviation}"
Command="{Binding ButtonSelectedCommand}"
CommandParameter="{x:Reference userFive}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="1"
BackgroundColor="{Binding UserSelectionList[4].BackgroundColor}"
d:BackgroundColor="#F26D21" />
<Button x:Name="userSix"
d:Text="GQ"
Text="{Binding UserSelectionList[5].Abbreviation}"
CommandParameter="{x:Reference userSix}"
Command="{Binding ButtonSelectedCommand}"
TextColor="White"
HorizontalOptions="Center"
VerticalOptions="Center"
BorderWidth="1"
FontSize="92"
CornerRadius="160"
HeightRequest="320"
WidthRequest="320"
Grid.Row="2"
Grid.Column="2"
BackgroundColor="{Binding UserSelectionList[5].BackgroundColor}"
d:BackgroundColor="#C02F1D" />
</Grid>
</StackLayout>
</ContentPage.Content>
Problem is for some reason it has free space inclusive if I use FillAndExpand on main StackLayout
I read about that but people just say that I missing FillAndExpand, I think problem is because I use Orientation="Horizontal" into first StackLayout, but that is the way I found to merge side bar with gridview. How can I achieve this? Regards
Add HorizontalOptions to the Grid itself:
<Grid HorizontalOptions="FillAndExpand" BackgroundColor="AliceBlue">

My menuitems in list view are not displaying Xamarin

I've just started learning Xamarin, I have a problem while creating a listview. I want to create a button below each item in the list so I've seen that Xamarin gives you an option to create a button, MenuItem, but when I display my view it is not showed anywhere. This is the code of the listView, I believe that rest of the code is not necessary but if it is, I will edit.
<ListView x:Name="lvActivities" HasUnevenRows="True"
RelativeLayout.XConstraint="{ConstraintExpression
Type=RelativeToParent, Property=Width, Factor=0,Constant=0}"
RelativeLayout.YConstraint="{ConstraintExpression
Type=RelativeToParent, Property=Height, Factor=0.2,Constant=0}"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToView, Property=Width, Factor=1, Constant=0,ElementName=rlAlumnInfo}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToParent, Property=Height, Factor=0.76, Constant=0}">
<ListView.ItemTemplate >
<DataTemplate >
<ViewCell >
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Text="{Binding title}" FontSize="20" Grid.Row="0" Grid.Column="0" Margin="5,5,5,5" />
<StackLayout Grid.Row="0" Grid.Column="1" Orientation="Horizontal" Margin="5,5,5,5">
<Label Text="Aula :" FontSize="20"/>
<Label Text="{Binding cRoom}" FontSize="20" Margin="8,0,0,0"/>
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="0" Orientation="Horizontal" Margin="5,5,5,5" Grid.ColumnSpan="2">
<Label Text="Dia :" FontSize="20"/>
<Label Text="{Binding dateHour}" FontSize="20" Margin="8,0,0,0"/>
</StackLayout>
</Grid>
<ViewCell.ContextActions>
<MenuItem Text="Eliminar" Clicked="deleteActivity_Clicked" CommandParameter="{Binding .}"/>
</ViewCell.ContextActions>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

TitleView not covering the entire toolbar

I am developing notification count on Toolbar using TitleView. Inside TitleView I have used RelativeLayout which is cropping from top side not showing full count circle Label.
This is my code:
<NavigationPage.TitleView>
<RelativeLayout HorizontalOptions="Fill" BackgroundColor="Transparent">
<Image Source="bell.png" HeightRequest="30" WidthRequest="30" x:Name="yellowBoxView"
RelativeLayout.YConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Height,
Factor=0.018,Constant=0}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=0.85,Constant=0}"/>
<Frame
CornerRadius="20"
Padding="-2"
BackgroundColor="White"
HasShadow="False"
RelativeLayout.YConstraint="{ConstraintExpression
Type=RelativeToView,
Property=Y,
ElementName=yellowBoxView,
Factor=1,Constant=-6}"
RelativeLayout.XConstraint="{ConstraintExpression
Type=RelativeToView,
Property=X,
ElementName=yellowBoxView,
Factor=1,Constant=-8}">
<Label FontSize="10" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BackgroundColor="Transparent" Text="2"
TextColor="Red" HeightRequest="22" WidthRequest="23" x:Name="labelText"/>
</Frame>
</RelativeLayout>
</NavigationPage.TitleView>
This is my output:
You can try this solution might be it is useful for you
<?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="XamarinTest.View.Page3">
<NavigationPage.TitleView >
<StackLayout BackgroundColor="Transparent">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100*"/>
</Grid.ColumnDefinitions>
<Image Source="notification.png" Grid.Row="0" Grid.Column="0" HorizontalOptions="End" VerticalOptions="Center" HeightRequest="25" WidthRequest="25"/>
<Frame Grid.Row="0" Grid.Column="0" HorizontalOptions="End" VerticalOptions="Center" Margin="0,-25,10,0" CornerRadius="20"
Padding="-2"
BackgroundColor="White"
HasShadow="False">
<Label FontSize="10" HeightRequest="22" WidthRequest="23" Margin="1,1,1,1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BackgroundColor="Transparent" Text="100"
TextColor="Red" x:Name="labelText"/>
</Frame>
</Grid>
</StackLayout>
</NavigationPage.TitleView>
<ContentPage.Content>
<StackLayout >
<Label Text="Hello" />
</StackLayout>
</ContentPage.Content>
</ContentPage>

Grid doesn't fill parent grid in xamarin forms

In my xamarin forms project
I need that the White Grid fill the aqua Grid. without relativeLayout it doesn't happens, so, I tried to use relative layout for it but it stills not working....
I have no ideas now...Why does it happen?
how it is now:
this is My xaml code for this page grid:
<RelativeLayout VerticalOptions="FillAndExpand">
<!--Picker Grid-->
<Grid BackgroundColor="Aqua" x:Name="lojas_grid_picker" VerticalOptions="FillAndExpand"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}">
<Image Source="pickers.png"
Opacity="0.5"
Aspect="Fill"
VerticalOptions="FillAndExpand"
Grid.Row="0"
Grid.Column="0"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"/>
<!--left, top, right, bottom-->
<!--<StackLayout
x:Name="lojas_stack_pickers"
Grid.Row="0"
Grid.Column="0"
VerticalOptions="CenterAndExpand">
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness"
Android="10, 5, 30, 30"
iOS="10, 10, 30, 30"/>
</StackLayout.Padding>
<StackLayout.Spacing>
<OnPlatform x:TypeArguments="x:Double"
Android="10"
iOS="50"/>
</StackLayout.Spacing>-->
<Grid BackgroundColor="White" Grid.Row="0" Grid.Column="0" x:Name="lojas_stack_pickers" VerticalOptions="FillAndExpand"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=X,
Factor=1,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Y,
Factor=1,
Constant=0}"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToView,
ElementName=lojas_grid_picker,
Property=Height,
Factor=1,
Constant=0}">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Picker Grid.Row="0" x:Name="estadopicker" TextColor="{StaticResource MarromEscuro}" Title="Estado" SelectedIndexChanged="PickerEstado_SelectedindexChanged" VerticalOptions="FillAndExpand"/>
<Picker Grid.Row="1" x:Name="cidadepicker" TextColor="{StaticResource MarromEscuro}" VerticalOptions="FillAndExpand" ItemsSource="{Binding cidadeItems}" Title="Cidade" SelectedIndexChanged="PickerCidade_SelectedindexChanged"/>
<Picker Grid.Row="2" Margin="0,0,0,20" x:Name="lojapicker" VerticalOptions="FillAndExpand" TextColor="{StaticResource MarromEscuro}" Title="Loja" SelectedIndexChanged="PickerLoja_SelectedindexChanged"/>
</Grid>
<!--</StackLayout>-->
</Grid>
<!--Picker Grid-->
</RelativeLayout>
Complete Code:
<?xaml 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="neoFly_Montana.Views.ProcuraLojasView"
xmlns:local="clr-namespace:neoFly_Montana.LayoutScripts"
Title="Nossas Lojas">
<ContentPage.Content>
<Grid VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" >
<Image Source="backgroundlojas.jpg" Grid.Row="0" Grid.Column="0" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Aspect="Fill"/>
<StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="Fill" VerticalOptions="FillAndExpand">
<StackLayout VerticalOptions="CenterAndExpand" Padding="60">
<Label Text="Escolha uma loja" Style="{StaticResource labelsfont}" Margin="0,0,30,0" FontSize="Large" TextColor="White"/>
<StackLayout Spacing="0">
<RelativeLayout
VerticalOptions="FillAndExpand">
<!--Picker Grid-->
<Grid BackgroundColor="Aqua" x:Name="lojas_grid_picker" VerticalOptions="FillAndExpand"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}">
<Image Source="pickers.png"
Opacity="0.5"
Aspect="Fill"
VerticalOptions="FillAndExpand"
Grid.Row="0"
Grid.Column="0"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"/>
<!--left, top, right, bottom-->
<!--<StackLayout
x:Name="lojas_stack_pickers"
Grid.Row="0"
Grid.Column="0"
VerticalOptions="CenterAndExpand">
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness"
Android="10, 5, 30, 30"
iOS="10, 10, 30, 30"/>
</StackLayout.Padding>
<StackLayout.Spacing>
<OnPlatform x:TypeArguments="x:Double"
Android="10"
iOS="50"/>
</StackLayout.Spacing>-->
<Grid BackgroundColor="White" Grid.Row="0" Grid.Column="0" x:Name="lojas_stack_pickers" VerticalOptions="FillAndExpand"
RelativeLayout.XConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=X,
Factor=1,
Constant=0}"
RelativeLayout.YConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Y,
Factor=1,
Constant=0}"
RelativeLayout.WidthConstraint="{ConstraintExpression
Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint="{ConstraintExpression
Type=RelativeToView,
ElementName=lojas_grid_picker,
Property=Height,
Factor=1,
Constant=0}">
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="4*"/>
</Grid.RowDefinitions>
<Picker Grid.Row="0" x:Name="estadopicker" TextColor="{StaticResource MarromEscuro}" Title="Estado" SelectedIndexChanged="PickerEstado_SelectedindexChanged" VerticalOptions="FillAndExpand"/>
<Picker Grid.Row="1" x:Name="cidadepicker" TextColor="{StaticResource MarromEscuro}" VerticalOptions="FillAndExpand" ItemsSource="{Binding cidadeItems}" Title="Cidade" SelectedIndexChanged="PickerCidade_SelectedindexChanged"/>
<Picker Grid.Row="2" Margin="0,0,0,20" x:Name="lojapicker" VerticalOptions="FillAndExpand" TextColor="{StaticResource MarromEscuro}" Title="Loja" SelectedIndexChanged="PickerLoja_SelectedindexChanged"/>
</Grid>
<!--</StackLayout>-->
</Grid>
<!--Picker Grid-->
</RelativeLayout>
<Label x:Name="lbl_ou" Text="ou" Style="{StaticResource labelsfont}" TextColor="White" FontSize="Large"/>
<!--Loja mais próxima Grid-->
<Grid x:Name="loja_prox_btn" VerticalOptions="EndAndExpand">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image Source="lojamaisproximabtn.png"
Aspect="Fill"
Grid.Row="0"
Grid.Column="0">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="BtnOnTapGestureRecognizerTapped"/>
</Image.GestureRecognizers>
</Image>
<StackLayout
Orientation="Horizontal"
VerticalOptions="Center"
HorizontalOptions="Center"
Margin="0,30,0,15"
Grid.Row="0"
Grid.Column="0">
<Image Source="reloadicon.png" VerticalOptions="Center"/>
<Label Text="Vá para a loja mais próxima" VerticalOptions="Center" FontAttributes="Bold" FontSize="Micro" FontFamily="Arial" TextColor="{StaticResource MarromEscuro}"/>
</StackLayout>
</Grid>
<!--Loja mais próxima Grid-->
</StackLayout>
</StackLayout>
<!--Rodapé Grid-->
<RelativeLayout HorizontalOptions="FillAndExpand" VerticalOptions="EndAndExpand">
<Grid
RelativeLayout.WidthConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Image Source="rodape.png"
Margin="0,20,0,0"
Aspect="Fill"
HorizontalOptions="FillAndExpand"
Grid.Row="0"
Grid.Column="0">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="FranqueadoOnTapGestureRecognizerTapped"/>
</Image.GestureRecognizers>
</Image>
<!--Escrito Rodapé-->
<StackLayout Orientation="Vertical"
VerticalOptions="EndAndExpand"
HorizontalOptions="FillAndExpand"
Grid.Row="0"
Spacing="0"
Grid.Column="0">
<Image Source="franqButton.png">
<Image.Scale>
<OnPlatform x:TypeArguments="x:Double"
iOS="0.75"
Android="0.75"/>
</Image.Scale>
</Image>
<StackLayout Spacing="0" Orientation="Horizontal" HorizontalOptions="Center"
Margin="0,0,0,10">
<local:MyLabel NamedFontSize="Medium"
FontSizeFactor="0.7"
Text="SEJA UM FRANQUEADO: "
TextColor="White"
FontAttributes="Bold"
Style="{StaticResource labelsfont}"/>
<local:MyLabel NamedFontSize="Medium"
FontSizeFactor="0.7" Text="montanaexpress.com"
Style="{StaticResource labelsfont}"
TextColor="{StaticResource laranjacolor}"/>
</StackLayout>
</StackLayout>
</Grid>
</RelativeLayout>
</StackLayout>
</Grid>
</ContentPage.Content>
What is the problem?