xamarinxamarin.formsxamarin.android

TapGestureRecognizer not work on Grid Row


I have proposed the following layout.

In the yellow area it will be reserved for a bar of options and user data. The red zone will be reserved for a listView and some options.

The problem is that when you put the layout in the following way:

<Grid 
   Grid.Row="1"
   Padding="0" 
   HorizontalOptions="FillAndExpand"
   VerticalOptions="FillAndExpand"
  IsVisible="{ Binding ErrorOccurred , Converter = { StaticResource InverseBoolConverter }  }">

    <Grid.RowDefinitions>
         <RowDefinition Height="Auto" />
         <RowDefinition Height="*" />
    </Grid.RowDefinitions>

    <Grid Grid.Row="0" HeightRequest="250" BackgroundColor="Yellow"></Grid>

      <StackLayout 
             x:Name="Body"
             Grid.Row="1"
             BackgroundColor="Red"
             HorizontalOptions="FillAndExpand"
             VerticalOptions="EndAndExpand"
             Padding="0"
            Spacing="0">
     </StackLayout>
</Grid>

The scroll of the ListView and the TapGestureRecognizer that I have placed in the Red StackLayout. They do not work. Instead, I use a StackLayout instead of a Grid. Everything works. But I can not get the red StackLayout to occupy all the remaining space.

Someone knows I can be doing wrong?

This is the complete page code.

<ContentPage.Content>
        <!-- MAIN CONTAINER -->
        <Grid RowSpacing="0">
            
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>

            <!-- APP Header -->
            <common:AppHeader 
                Grid.Row="0"
                Title="{i18n:Translate Page.Home.Title}"
                BackEnable="false">
                <common:AppHeader.Options>
                    <x:Array Type="{x:Type View}">
                        <common:RefreshOptionMenu />
                        <common:SettingsOptionMenu />
                        <common:SignOutOptionMenu />
                    </x:Array>
                </common:AppHeader.Options>

            </common:AppHeader>
            <!-- End APP Header -->
                
            <!--GRID WRAPPER-->
            <Grid 
                 Grid.Row="1"
                 Padding="0" 
                 IsVisible="{ Binding ErrorOccurred , Converter = { StaticResource InverseBoolConverter }  }">

                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <!-- PROFILE HEADER-->
                    <Grid 
                        Grid.Row="0"
                        HeightRequest="250"
                        Padding="0">

                        <!-- BACKGROUND IMAGE -->
                        <Image 
                            Source="{ StaticResource HomeBackground }"
                            IsOpaque="false"
                            Aspect="AspectFill"
                            HorizontalOptions="FillAndExpand"
                            VerticalOptions="FillAndExpand"/>

                        <StackLayout
                            
                            HorizontalOptions="FillAndExpand" 
                            VerticalOptions="StartAndExpand"
                            Orientation="Vertical"
                            Spacing="20">

                            <Grid 
                                HorizontalOptions="Center"
                                VerticalOptions="Center"
                                TranslationY="25">

                                <!-- AVATAR -->
                                <ffimageloading:CachedImage
                                    x:Name="profileImage"
                                    CacheType="Disk"
                                    CacheDuration="30"
                                    WidthRequest="100"
                                    HeightRequest="100"
                                    FadeAnimationEnabled="true"
                                    ErrorPlaceholder="{ StaticResource ProfileErrorImage }"
                                    LoadingPlaceholder="{ StaticResource ProfileImagePlaceholder }"
                                    Source="{ Binding SelfParent.ProfileImage , Converter={ StaticResource ParentProfileImageURLConverter } }">
                                    <ffimageloading:CachedImage.Transformations>
                                         <fftransformations:CircleTransformation BorderSize="5" BorderHexColor="#FFFFFF" />
                                    </ffimageloading:CachedImage.Transformations>
                                 </ffimageloading:CachedImage>

                                  <!-- BADGE -->
                                  <common:Badge
                                    IsVisible="{ Binding  AlertsPage.Remaining, Converter={ StaticResource ValueGreaterThanZeroConverter }}"
                                    BadgeText="{ Binding  AlertsPage.Remaining, StringFormat='+ {0}'}"
                                    BadgeTextColor="{ DynamicResource InverseTextColor }"
                                    BadgeBackgroundColor="#22c064"
                                    HorizontalOptions="Center"
                                    VerticalOptions="Start"
                                    TranslationX="40">

                                    <common:Badge.GestureRecognizers>
                                        <TapGestureRecognizer Command="{ Binding GoToAlertsCommand }" NumberOfTapsRequired="1" /> 
                                    </common:Badge.GestureRecognizers>

                                </common:Badge>

                                <Grid.GestureRecognizers>
                                    <TapGestureRecognizer Command="{ Binding TakePhotoCommand }"  NumberOfTapsRequired="1" />
                                </Grid.GestureRecognizers>
                            </Grid>

                            <!-- Parent FullName -->
                            <StackLayout
                                Orientation="Horizontal"
                                HorizontalOptions="CenterAndExpand"
                                Padding="20">

                                <Label 
                                    HorizontalOptions="CenterAndExpand"
                                    Text="{Binding SelfParent.FullName}"
                                    TextColor="{ DynamicResource OverImageTextColor }"
                                    HorizontalTextAlignment="Center"
                                    FontAttributes="Bold"
                                    FontSize="{ artina:OnOrientationDouble
                                        PortraitPhone=22,
                                        LandscapePhone=22,
                                        PortraitTablet=24,
                                        LandscapeTablet=24 }"  />
                            </StackLayout>
                        </StackLayout>

                        <!-- TOOLBAR -->
                        <Grid
                            x:Name="MenuGrid"
                            VerticalOptions="End"
                            Style="{ StaticResource ToolbarStyle }"
                            BackgroundColor="{ DynamicResource TranslucidWhite }">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>


                            <!-- Children Action -->
                            <StackLayout
                                Grid.Column="0"
                                Orientation="Horizontal"
                                VerticalOptions="CenterAndExpand"
                                HorizontalOptions="Center"
                                Spacing="0">

                                <Label
                                    VerticalTextAlignment="Center"
                                    HorizontalTextAlignment="Center"
                                    Text="{ x:Static helper:FontAwesomeFont.Users }"
                                    FontFamily="{ StaticResource IconsFontFamily }"
                                    TextColor="{ DynamicResource InverseTextColor }">

                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15" 
                                            Tablet="20" />
                                    </Label.FontSize>
                                </Label>

                                <Label
                                    VerticalTextAlignment="Center"
                                    HorizontalTextAlignment="Center"
                                    Text="{Binding SelfParent.Children, StringFormat={i18n:Translate Home.Toolbar.Children} }"
                                    TextColor="{ DynamicResource OverImageTextColor }">
                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15" 
                                            Tablet="20" />
                                    </Label.FontSize> 
                                </Label>

                                <StackLayout.GestureRecognizers>
                                    <TapGestureRecognizer Command="{ Binding GoToChildrenCommand }" NumberOfTapsRequired="1" /> 
                                </StackLayout.GestureRecognizers>
                             </StackLayout>

                               <!-- IsEnabled="{ Binding SelfParent.Children, Converter={ StaticResource ValueGreaterThanZeroConverter }}" -->
                              <!-- Results Action -->
                              <StackLayout
                                Grid.Column="1"
                                Orientation="Horizontal"
                                VerticalOptions="CenterAndExpand"
                                HorizontalOptions="Center"
                                Spacing="0">

                                    <Label
                                        VerticalTextAlignment="Center"
                                        HorizontalTextAlignment="Center"
                                        Text="{ x:Static helper:FontAwesomeFont.AreaChart }"
                                        FontFamily="{ StaticResource IconsFontFamily }"
                                        TextColor="{ DynamicResource InverseTextColor }">
                                        <Label.FontSize>
                                            <OnIdiom 
                                                x:TypeArguments="x:Double" 
                                                Phone="15" 
                                                Tablet="20" />
                                         </Label.FontSize> 
                                     </Label>

                                      <Label
                                        VerticalTextAlignment="Center" 
                                        HorizontalTextAlignment="Center"
                                        Text="{i18n:Translate Home.Toolbar.Results}"
                                        TextColor="{ DynamicResource OverImageTextColor }">

                                        <Label.FontSize>
                                            <OnIdiom 
                                                x:TypeArguments="x:Double" 
                                                Phone="15"
                                                Tablet="20" />
                                         </Label.FontSize> 
                                    </Label>

                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer Command="{ Binding GoToResultsCommand}" NumberOfTapsRequired="1" /> 
                                    </StackLayout.GestureRecognizers>
                            </StackLayout>

                            <!-- Profile Action -->
                            <StackLayout
                                Grid.Column="2"
                                Orientation="Horizontal"
                                VerticalOptions="CenterAndExpand"
                                HorizontalOptions="Center"
                                Spacing="0">

                                    <Label
                                        VerticalTextAlignment="Center" 
                                        HorizontalTextAlignment="Center"
                                        Text="{ x:Static helper:FontAwesomeFont.User }"
                                        FontFamily="{ StaticResource IconsFontFamily }"
                                        TextColor="{ DynamicResource InverseTextColor }">
                                        <Label.FontSize>
                                            <OnIdiom 
                                                x:TypeArguments="x:Double" 
                                                Phone="15" 
                                                Tablet="20" />
                                        </Label.FontSize> 
                                    </Label>

                                    <Label
                                        VerticalTextAlignment="Center" 
                                        HorizontalTextAlignment="Center"
                                        Text="{i18n:Translate Home.Toolbar.Profile}"
                                        TextColor="{ DynamicResource OverImageTextColor }">
                                        <Label.FontSize>
                                            <OnIdiom 
                                                x:TypeArguments="x:Double" 
                                                Phone="15" 
                                                Tablet="20" />
                                        </Label.FontSize> 
                                    </Label>

                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer Command="{ Binding GoToProfileCommand }" NumberOfTapsRequired="1" /> 
                                    </StackLayout.GestureRecognizers>
                               </StackLayout>
                            </Grid>
                        </Grid>
                        <!-- END PROFILE HEADER-->

                       <StackLayout 
                                x:Name="Body"
                                BackgroundColor="White"
                                Grid.Row="1"
                                HorizontalOptions="FillAndExpand"
                                VerticalOptions="StartAndExpand"
                                Padding="0">

                                <StackLayout
                                    Orientation="Horizontal">

                                    <StackLayout  
                                        Orientation="Horizontal"
                                        HorizontalOptions="StartAndExpand">

                                        <Label
                                            FontSize="18"
                                            Style="{ StaticResource CommonHeaderStyle }"
                                            Text="{ x:Static helper:FontAwesomeFont.Inbox }"
                                            FontFamily="{ StaticResource IconsFontFamily }" />

                                        <Label
                                            Style="{ StaticResource CommonHeaderStyle }"
                                            Text="{ Binding ListAlertTitle }"/>
                                    </StackLayout>

                                    <StackLayout
                                        Orientation="Horizontal"
                                        HorizontalOptions="End">

                                        <Label
                                            FontSize="14"
                                            HeightRequest="46"
                                            VerticalTextAlignment="Center"
                                            Text="{ i18n:Translate Home.Show.Alerts }"/>

                                        <Label
                                            Text="{ x:Static helper:FontAwesomeFont.ArrowRight }"
                                            VerticalTextAlignment="Center"
                                            Margin="5,0,5,0"
                                            FontFamily="{ StaticResource IconsFontFamily }" />

                                            <StackLayout.GestureRecognizers>
                                                <TapGestureRecognizer Command="{ Binding GoToAlertsCommand }" NumberOfTapsRequired="1" /> 
                                            </StackLayout.GestureRecognizers>
                                    </StackLayout>
                                </StackLayout>

                                <!-- Last Alerts LIST -->
                                <ListView
                                    x:Name="AlertsListView"
                                    ItemsSource="{Binding AlertsPage.Alerts}"
                                    RowHeight="90">

                                    <ListView.Behaviors>
                                        <utils:EventToCommandBehavior 
                                            EventName="ItemTapped"
                                            Command="{Binding ShowAlertDetailCommand}"
                                            EventArgsConverter="{ StaticResource ItemTappedEventArgsConverter }" />
                                    </ListView.Behaviors>

                                    <ListView.ItemTemplate>
                                        <DataTemplate>
                                            <commonControls:SearchPageViewCellWithId 
                                                FirstApper="SearchPageViewCellWithId_OnFirstApper"
                                                FirstDisapp="SearchPageViewCellWithId_OnFirstDisapp" 
                                                ItemId="{ Binding .,
                                                    Converter = { StaticResource ItemToIndexConverter }, 
                                                    ConverterParameter = { x:Reference AlertsListView } }">
                                                <templates:AlertItemTemplate/>
                                            </commonControls:SearchPageViewCellWithId>
                                        </DataTemplate>
                                    </ListView.ItemTemplate>
                                </ListView>

                                <StackLayout.Triggers>
                                    <DataTrigger 
                                        TargetType="StackLayout"
                                        Binding="{Binding AlertsPage.Returned, Converter={ StaticResource ValueEqualToZeroConverter } }"
                                        Value="True">
                                        <Setter Property="IsVisible" Value="False" />
                                    </DataTrigger>
                                    <DataTrigger
                                       TargetType="StackLayout"
                                        Binding="{Binding IsBusy}"
                                        Value="True">
                                        <Setter Property="IsVisible" Value="False" />
                                    </DataTrigger>
                                </StackLayout.Triggers>
                            </StackLayout>

                            <templates:NoChildrenFound
                                Grid.Row="1"
                                IsVisible="{ Binding ShouldShowNoChildrenFound}"
                                VerticalOptions="CenterAndExpand"
                                Padding="20" />

                            <common:ActivityLoading
                                Grid.Row="1"
                                Icon="{ x:Static helper:FontAwesomeFont.Bell }"
                                IsLoading="{ Binding IsBusy }"
                                LoadingText="{i18n:Translate Common.Loading}"/>

                             <!-- No Alerts Found -->
                            <common:NoDataFound 
                                Grid.Row="1"
                                IsVisible="{ Binding ShouldShowNoAlertsFound }"
                                MainText="{i18n:Translate Home.Alerts.Not.Found.MainText }"
                                DetailText="{i18n:Translate Home.Alerts.Not.Found.SecondText }">
                            </common:NoDataFound>
                </Grid>
                <!-- END GRID WRAPPER--> 

                <common:ErrorOcurred 
                    Grid.Row="1"
                    IsVisible="{ Binding ErrorOccurred }"
                    MainText="{i18n:Translate Home.Profile.Load.Error}"/>

                
           </Grid>
           <!-- END MAIN CONTAINER -->
    </ContentPage.Content>

Thanks in advance.


Solution

  • Try change your XAML code to this (you need to test, I couldn't do it here):

    <ContentPage.Content>
        <!-- MAIN CONTAINER -->
        <Grid RowSpacing="0">
    
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
    
            <!-- APP Header -->
            <common:AppHeader 
                Grid.Row="0"
                Title="{i18n:Translate Page.Home.Title}"
                BackEnable="false">
                <common:AppHeader.Options>
                    <x:Array Type="{x:Type View}">
                        <common:RefreshOptionMenu />
                        <common:SettingsOptionMenu />
                        <common:SignOutOptionMenu />
                    </x:Array>
                </common:AppHeader.Options>
    
            </common:AppHeader>
            <!-- End APP Header -->
    
            <!--GRID WRAPPER-->
            <Grid 
                 Grid.Row="1"
                 Padding="0" 
                 IsVisible="{ Binding ErrorOccurred , Converter = { StaticResource InverseBoolConverter }  }">
    
                <Grid.RowDefinitions>
                    <RowDefinition Height="250" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
    
                <!-- PROFILE HEADER-->
                <Grid 
                    Grid.Row="0"
                    Padding="0">
    
                    <!-- BACKGROUND IMAGE -->
                    <Image 
                        Source="{ StaticResource HomeBackground }"
                        IsOpaque="false"
                        Aspect="AspectFill"
                        HorizontalOptions="FillAndExpand"
                        VerticalOptions="FillAndExpand"/>
    
                    <StackLayout
    
                        HorizontalOptions="FillAndExpand" 
                        VerticalOptions="StartAndExpand"
                        Orientation="Vertical"
                        Spacing="20">
    
                        <Grid 
                            HorizontalOptions="Center"
                            VerticalOptions="Center"
                            TranslationY="25">
    
                            <!-- AVATAR -->
                            <ffimageloading:CachedImage
                                x:Name="profileImage"
                                CacheType="Disk"
                                CacheDuration="30"
                                WidthRequest="100"
                                HeightRequest="100"
                                FadeAnimationEnabled="true"
                                ErrorPlaceholder="{ StaticResource ProfileErrorImage }"
                                LoadingPlaceholder="{ StaticResource ProfileImagePlaceholder }"
                                Source="{ Binding SelfParent.ProfileImage , Converter={ StaticResource ParentProfileImageURLConverter } }">
                                <ffimageloading:CachedImage.Transformations>
                                     <fftransformations:CircleTransformation BorderSize="5" BorderHexColor="#FFFFFF" />
                                </ffimageloading:CachedImage.Transformations>
                             </ffimageloading:CachedImage>
    
                              <!-- BADGE -->
                              <common:Badge
                                IsVisible="{ Binding  AlertsPage.Remaining, Converter={ StaticResource ValueGreaterThanZeroConverter }}"
                                BadgeText="{ Binding  AlertsPage.Remaining, StringFormat='+ {0}'}"
                                BadgeTextColor="{ DynamicResource InverseTextColor }"
                                BadgeBackgroundColor="#22c064"
                                HorizontalOptions="Center"
                                VerticalOptions="Start"
                                TranslationX="40">
    
                                <common:Badge.GestureRecognizers>
                                    <TapGestureRecognizer Command="{ Binding GoToAlertsCommand }" NumberOfTapsRequired="1" /> 
                                </common:Badge.GestureRecognizers>
    
                            </common:Badge>
    
                            <Grid.GestureRecognizers>
                                <TapGestureRecognizer Command="{ Binding TakePhotoCommand }"  NumberOfTapsRequired="1" />
                            </Grid.GestureRecognizers>
                        </Grid>
    
                        <!-- Parent FullName -->
                        <StackLayout
                            Orientation="Horizontal"
                            HorizontalOptions="CenterAndExpand"
                            Padding="20">
    
                            <Label 
                                HorizontalOptions="CenterAndExpand"
                                Text="{Binding SelfParent.FullName}"
                                TextColor="{ DynamicResource OverImageTextColor }"
                                HorizontalTextAlignment="Center"
                                FontAttributes="Bold"
                                FontSize="{ artina:OnOrientationDouble
                                    PortraitPhone=22,
                                    LandscapePhone=22,
                                    PortraitTablet=24,
                                    LandscapeTablet=24 }"  />
                        </StackLayout>
                    </StackLayout>
    
                    <!-- TOOLBAR -->
                    <Grid
                        x:Name="MenuGrid"
                        VerticalOptions="End"
                        Style="{ StaticResource ToolbarStyle }"
                        BackgroundColor="{ DynamicResource TranslucidWhite }">
    
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
    
    
                        <!-- Children Action -->
                        <StackLayout
                            Grid.Column="0"
                            Orientation="Horizontal"
                            VerticalOptions="CenterAndExpand"
                            HorizontalOptions="Center"
                            Spacing="0">
    
                            <Label
                                VerticalTextAlignment="Center"
                                HorizontalTextAlignment="Center"
                                Text="{ x:Static helper:FontAwesomeFont.Users }"
                                FontFamily="{ StaticResource IconsFontFamily }"
                                TextColor="{ DynamicResource InverseTextColor }">
    
                                <Label.FontSize>
                                    <OnIdiom 
                                        x:TypeArguments="x:Double" 
                                        Phone="15" 
                                        Tablet="20" />
                                </Label.FontSize>
                            </Label>
    
                            <Label
                                VerticalTextAlignment="Center"
                                HorizontalTextAlignment="Center"
                                Text="{Binding SelfParent.Children, StringFormat={i18n:Translate Home.Toolbar.Children} }"
                                TextColor="{ DynamicResource OverImageTextColor }">
                                <Label.FontSize>
                                    <OnIdiom 
                                        x:TypeArguments="x:Double" 
                                        Phone="15" 
                                        Tablet="20" />
                                </Label.FontSize> 
                            </Label>
    
                            <StackLayout.GestureRecognizers>
                                <TapGestureRecognizer Command="{ Binding GoToChildrenCommand }" NumberOfTapsRequired="1" /> 
                            </StackLayout.GestureRecognizers>
                         </StackLayout>
    
                           <!-- IsEnabled="{ Binding SelfParent.Children, Converter={ StaticResource ValueGreaterThanZeroConverter }}" -->
                          <!-- Results Action -->
                          <StackLayout
                            Grid.Column="1"
                            Orientation="Horizontal"
                            VerticalOptions="CenterAndExpand"
                            HorizontalOptions="Center"
                            Spacing="0">
    
                                <Label
                                    VerticalTextAlignment="Center"
                                    HorizontalTextAlignment="Center"
                                    Text="{ x:Static helper:FontAwesomeFont.AreaChart }"
                                    FontFamily="{ StaticResource IconsFontFamily }"
                                    TextColor="{ DynamicResource InverseTextColor }">
                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15" 
                                            Tablet="20" />
                                     </Label.FontSize> 
                                 </Label>
    
                                  <Label
                                    VerticalTextAlignment="Center" 
                                    HorizontalTextAlignment="Center"
                                    Text="{i18n:Translate Home.Toolbar.Results}"
                                    TextColor="{ DynamicResource OverImageTextColor }">
    
                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15"
                                            Tablet="20" />
                                     </Label.FontSize> 
                                </Label>
    
                                <StackLayout.GestureRecognizers>
                                    <TapGestureRecognizer Command="{ Binding GoToResultsCommand}" NumberOfTapsRequired="1" /> 
                                </StackLayout.GestureRecognizers>
                        </StackLayout>
    
                        <!-- Profile Action -->
                        <StackLayout
                            Grid.Column="2"
                            Orientation="Horizontal"
                            VerticalOptions="CenterAndExpand"
                            HorizontalOptions="Center"
                            Spacing="0">
    
                                <Label
                                    VerticalTextAlignment="Center" 
                                    HorizontalTextAlignment="Center"
                                    Text="{ x:Static helper:FontAwesomeFont.User }"
                                    FontFamily="{ StaticResource IconsFontFamily }"
                                    TextColor="{ DynamicResource InverseTextColor }">
                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15" 
                                            Tablet="20" />
                                    </Label.FontSize> 
                                </Label>
    
                                <Label
                                    VerticalTextAlignment="Center" 
                                    HorizontalTextAlignment="Center"
                                    Text="{i18n:Translate Home.Toolbar.Profile}"
                                    TextColor="{ DynamicResource OverImageTextColor }">
                                    <Label.FontSize>
                                        <OnIdiom 
                                            x:TypeArguments="x:Double" 
                                            Phone="15" 
                                            Tablet="20" />
                                    </Label.FontSize> 
                                </Label>
    
                                <StackLayout.GestureRecognizers>
                                    <TapGestureRecognizer Command="{ Binding GoToProfileCommand }" NumberOfTapsRequired="1" /> 
                                </StackLayout.GestureRecognizers>
                           </StackLayout>
                        </Grid>
                    </Grid>
                    <!-- END PROFILE HEADER-->
    
               <StackLayout 
                        x:Name="Body"
                        BackgroundColor="White"
                        Grid.Row="1"
                        HorizontalOptions="FillAndExpand"
                        VerticalOptions="StartAndExpand"
                        Padding="0">
    
                        <StackLayout
                            Orientation="Horizontal">
    
                            <StackLayout  
                                Orientation="Horizontal"
                                HorizontalOptions="StartAndExpand">
    
                                <Label
                                    FontSize="18"
                                    Style="{ StaticResource CommonHeaderStyle }"
                                    Text="{ x:Static helper:FontAwesomeFont.Inbox }"
                                    FontFamily="{ StaticResource IconsFontFamily }" />
    
                                <Label
                                    Style="{ StaticResource CommonHeaderStyle }"
                                    Text="{ Binding ListAlertTitle }"/>
                            </StackLayout>
    
                            <StackLayout
                                Orientation="Horizontal"
                                HorizontalOptions="End">
    
                                <Label
                                    FontSize="14"
                                    HeightRequest="46"
                                    VerticalTextAlignment="Center"
                                    Text="{ i18n:Translate Home.Show.Alerts }"/>
    
                                <Label
                                    Text="{ x:Static helper:FontAwesomeFont.ArrowRight }"
                                    VerticalTextAlignment="Center"
                                    Margin="5,0,5,0"
                                    FontFamily="{ StaticResource IconsFontFamily }" />
    
                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer Command="{ Binding GoToAlertsCommand }" NumberOfTapsRequired="1" /> 
                                    </StackLayout.GestureRecognizers>
                            </StackLayout>
                        </StackLayout>
    
                        <!-- Last Alerts LIST -->
                        <ListView
                            x:Name="AlertsListView"
                            ItemsSource="{Binding AlertsPage.Alerts}"
                            VerticalOptions="FillAndExpand"
                            RowHeight="90">
    
                            <ListView.Behaviors>
                                <utils:EventToCommandBehavior 
                                    EventName="ItemTapped"
                                    Command="{Binding ShowAlertDetailCommand}"
                                    EventArgsConverter="{ StaticResource ItemTappedEventArgsConverter }" />
                            </ListView.Behaviors>
    
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <commonControls:SearchPageViewCellWithId 
                                        FirstApper="SearchPageViewCellWithId_OnFirstApper"
                                        FirstDisapp="SearchPageViewCellWithId_OnFirstDisapp" 
                                        ItemId="{ Binding .,
                                            Converter = { StaticResource ItemToIndexConverter }, 
                                            ConverterParameter = { x:Reference AlertsListView } }">
                                        <templates:AlertItemTemplate/>
                                    </commonControls:SearchPageViewCellWithId>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>
    
                        <StackLayout.Triggers>
                            <DataTrigger 
                                TargetType="StackLayout"
                                Binding="{Binding AlertsPage.Returned, Converter={ StaticResource ValueEqualToZeroConverter } }"
                                Value="True">
                                <Setter Property="IsVisible" Value="False" />
                            </DataTrigger>
                            <DataTrigger
                               TargetType="StackLayout"
                                Binding="{Binding IsBusy}"
                                Value="True">
                                <Setter Property="IsVisible" Value="False" />
                            </DataTrigger>
                        </StackLayout.Triggers>
                    </StackLayout>
    
                    <templates:NoChildrenFound
                        Grid.Row="1"
                        IsVisible="{ Binding ShouldShowNoChildrenFound}"
                        VerticalOptions="CenterAndExpand"
                        Padding="20" />
    
                    <common:ActivityLoading
                        Grid.Row="1"
                        Icon="{ x:Static helper:FontAwesomeFont.Bell }"
                        IsLoading="{ Binding IsBusy }"
                        LoadingText="{i18n:Translate Common.Loading}"/>
    
                     <!-- No Alerts Found -->
                    <common:NoDataFound 
                        Grid.Row="1"
                        IsVisible="{ Binding ShouldShowNoAlertsFound }"
                        MainText="{i18n:Translate Home.Alerts.Not.Found.MainText }"
                        DetailText="{i18n:Translate Home.Alerts.Not.Found.SecondText }">
                    </common:NoDataFound>
                </Grid>
                <!-- END GRID WRAPPER--> 
    
                <common:ErrorOcurred 
                    Grid.Row="1"
                    IsVisible="{ Binding ErrorOccurred }"
                    MainText="{i18n:Translate Home.Profile.Load.Error}"/>
    
    
           </Grid>
           <!-- END MAIN CONTAINER -->
    </ContentPage.Content>
    

    But if you don't mind, I 'ld like give you an advice: choose the correct layouts for your need. Besides the performance, you'll get rid of a lotta unnecessary code. See this article for more information.

    I hope it helps you.