Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Gesture on FlyLayout in Shell is not working on iOS 14.1 but works in Android.

JoannaGJoannaG Member ✭✭✭

I have added a gesture for FlyLayoutItem(one of template in TemplateSelector) which works fine in Android and also in all old ios versions (last used 13.3) but not working in 14.0. I have updated Visual Studio, XCode to the latest, and attached the below info for your details.

Gestures in all other pages are working but not this.

=== Visual Studio Community 2019 for Mac ===

Version 8.7.9 (build 9)
Installation UUID: 4016c3dc-d19e-4ab2-aac0-b84d621a8566
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 6.18.0.23 (d16-6 / 088c73638)

    Package version: 612000093

=== Mono Framework MDK ===

Runtime:
    Mono 6.12.0.93 (2020-02/620cf538206) (64-bit)
    Package version: 612000093

=== Roslyn (Language Service) ===

3.7.0-6.20427.1+18ede13943b0bfae1b44ef078b2f3923159bcd32

=== Xamarin Designer ===

Version: 16.7.0.495
Hash: 03d50a221
Branch: remotes/origin/d16-7-vsmac
Build date: 2020-08-28 13:12:52 UTC

=== NuGet ===

Version: 5.7.0.6702

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.1.403/Sdks
SDK Versions:
    3.1.403
    3.1.200
    3.1.101
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    3.1.9
    3.1.2
    3.1.1
    2.1.23
    2.1.17
    2.1.16
    2.1.15

=== Xamarin.Profiler ===

Version: 1.6.13.11
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Apple Developer Tools ===

Xcode 12.1 (17222)
Build 12A7403

=== Xamarin.Android ===

Version: 11.0.2.0 (Visual Studio Community)
Commit: xamarin-android/d16-7/025fde9
Android SDK: /Users/macmini1/Library/Android/sdk
    Supported Android versions:
        6.0 (API level 23)
        8.0 (API level 26)
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.5
SDK Build Tools Version: 29.0.2

Build Information: 
Mono: 83105ba
Java.Interop: xamarin/java.interop/[email protected]
ProGuard: Guardsquare/proguard/[email protected]
SQLite: xamarin/sqlite/[email protected]
Xamarin.Android Tools: xamarin/xamarin-android-tools/[email protected]

=== Microsoft OpenJDK for Mobile ===

Java SDK: /Users/macmini1/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 16.7.0.13
Hash: 8380518
Branch: remotes/origin/d16-7~2
Build date: 2020-09-16 05:12:24 UTC

=== Android Device Manager ===

Version: 16.7.0.24
Hash: bb090a3
Branch: remotes/origin/d16-7
Build date: 2020-09-16 05:12:46 UTC

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 14.2.0.12 (Visual Studio Community)
Hash: e0ce49680
Branch: xcode12.1
Build date: 2020-10-20 09:52:06-0400

=== Build Information ===

Release ID: 807090009
Git revision: d29d54665a1fc79986687a540a7a4676f97ad3da
Build date: 2020-10-21 15:05:18-04
Build branch: release-8.7
Xamarin extensions: d29d54665a1fc79986687a540a7a4676f97ad3da

=== Operating System ===

Mac OS X 10.15.7
Darwin 19.6.0 Darwin Kernel Version 19.6.0
    Mon Aug 31 22:12:52 PDT 2020
    root:xnu-6153.141.2~1/RELEASE_X86_64 x86_64

Any suggestions to help are really appreciated. Thanks.

Answers

  • ColeXColeX Member, Xamarin Team Xamurai

    I have added a gesture for FlyLayoutItem(one of template in TemplateSelector) which works fine in Android and also in all old ios versions (last used 13.3) but not working in 14.0.

    Could you provide a minimal repro project here ?

  • JoannaGJoannaG Member ✭✭✭
    edited November 2020

    Hi @ColeX ,

    I have shared the model xaml. Please find them. In this gesture added for LogoutTemplate. On tapping it navigates to empty page and gesture/Tapped event added for the LogOut Template never fires. It worked perfectly in 13.3 (last checked) but broken in 14.1 iOS.

    <?xml version="1.0" encoding="utf-8" ?>
    <controls:ShellExtended x:Class="Alden.One.Client.Dashboard.Views.DashboardPage"
                            xmlns="http://xamarin.com/schemas/2014/forms"
                            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                            xmlns:controls="clr-namespace:Alden.One.Client.Common.Presentation.Controls;assembly=Alden.One.Client.Common.Presentation"
                            xmlns:d="http://xamarin.com/schemas/2014/forms/design"
                            xmlns:iOsSpecific="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:views="clr-namespace:Alden.One.Client.Dashboard.Views;assembly=Alden.One.Client.Dashboard.Views"
                            x:Name="ShellExtended"
                            Title="Dashboard"
                            iOsSpecific:Page.UseSafeArea="true"
                            BackgroundColor="#4B5B51"
                            DetailItems="{Binding DetailItemsList}"
                            FlyoutBackgroundColor="{StaticResource White}"
                            mc:Ignorable="d">
    
        <controls:ShellExtended.Resources>
            <ResourceDictionary>
    
                <Style TargetType="Grid">
                    <Setter Property="RowSpacing" Value="0" />
                    <Setter Property="ColumnSpacing" Value="0" />
    
                </Style>
    
                <Style x:Key="FormDivider" TargetType="BoxView">
                    <Setter Property="HeightRequest" Value="0.4" />
                    <Setter Property="HorizontalOptions" Value="FillAndExpand" />
                    <Setter Property="Color" Value="Gray" />
                </Style>
    
                <DataTemplate x:Key="LogoutTemplate">
                    <StackLayout >
                        <Grid Margin="0,10">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.2*" />
                                <ColumnDefinition Width="0.8*" />
                            </Grid.ColumnDefinitions>
                            <Image Margin="10"
                               Aspect="AspectFit"
                               Source="menu_logout.png" />
                            <Label Grid.Column="1"
                               FontSize="Medium"
                               LineBreakMode="WordWrap"
                               MaxLines="1"
                               Text="{Binding Title}"
                               TextColor="{StaticResource AccentColor}"
                               VerticalTextAlignment="Center" />
    
                        </Grid>
                        <BoxView HeightRequest="5"/>
                        <StackLayout.GestureRecognizers>
                            <TapGestureRecognizer Command="{Binding Source={x:Reference ShellExtended}, Path=BindingContext.LogoutCommand}" Tapped="TapGestureRecognizer_OnTapped" />
                        </StackLayout.GestureRecognizers>
                    </StackLayout>
    
    
                </DataTemplate>
    
                <DataTemplate x:Key="SelectableItemTemplate">
                    <StackLayout>
                        <Grid Margin="0,10">
    
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="0.2*" />
                                <ColumnDefinition Width="0.5*" />
                                <ColumnDefinition Width="0.3*" />
                            </Grid.ColumnDefinitions>
    
                            <Image Margin="10" Source="{Binding FlyoutIcon}" />
    
                            <Label Grid.Column="1"
                               FontSize="Medium"
                               Text="{Binding Title}"
                               TextColor="{StaticResource AccentColor}"
                               VerticalTextAlignment="Center" />
    
                            <Switch Grid.Column="2" IsToggled="{Binding Source={x:Reference ShellExtended}, Path=BindingContext.IsOffline}" />
                            <Grid.GestureRecognizers>
                                <TapGestureRecognizer Command="{Binding Source={x:Reference ShellExtended}, Path=BindingContext.GoOfflineCommand}" Tapped="TapGestureRecognizer_OnTapped" />
                            </Grid.GestureRecognizers>
    
                        </Grid>
                        <BoxView HeightRequest="5" />
    
                    </StackLayout>
                </DataTemplate>
    
    
                <DataTemplate x:Key="OtherTemplate">
                    <StackLayout>
                        <Grid Margin="0,10">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="0.2*" />
                            <ColumnDefinition Width="0.8*" />
                        </Grid.ColumnDefinitions>
                        <Image Margin="10" Source="{Binding FlyoutIcon}" />
                        <Label Grid.Column="1"
                               FontSize="Medium"
                               Text="{Binding Title}"
                               TextColor="{StaticResource AccentColor}"
                               VerticalTextAlignment="Center" />
                    </Grid>
                        <BoxView HeightRequest="5" />
    
                    </StackLayout>
                </DataTemplate>
    
            </ResourceDictionary>
        </controls:ShellExtended.Resources>
    
        <controls:ShellExtended.ItemTemplate>
            <views:FlyOutItemTemplateSelector LogOutFeatureTileTemplate="{StaticResource LogoutTemplate}"
                                              OtherTileTemplate="{StaticResource OtherTemplate}"
                                              SelectableFeatureTileTemplate="{StaticResource SelectableItemTemplate}" />
        </controls:ShellExtended.ItemTemplate>
    
        <controls:ShellExtended.FlyoutHeader>
            <Grid Margin="0,10"
                  BackgroundColor="{StaticResource White}"
                  HeightRequest="75"
                  VerticalOptions="CenterAndExpand">
    
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="25*" />
                    <ColumnDefinition Width="75*" />
                </Grid.ColumnDefinitions>
    
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
    
                <Image Grid.Row="0"
                       Grid.RowSpan="2"
                       Grid.Column="0"
                       Margin="10"
                       Source="menu_profile.png" />
    
                <Label Grid.Row="0"
                       Grid.Column="1"
                       FontSize="Small"
                       MaxLines="1"
                       Text="{Binding UserName}"
                       TextColor="{StaticResource AccentColor}"
                       VerticalOptions="EndAndExpand"
                       VerticalTextAlignment="Center" />
    
                <Label Grid.Row="1"
                       Grid.Column="1"
                       FontSize="Small"
                       MaxLines="1"
                       Text="{Binding Email}"
                       TextColor="{StaticResource AccentColor}"
                       VerticalOptions="StartAndExpand"
                       VerticalTextAlignment="Center" />
    
            </Grid>
        </controls:ShellExtended.FlyoutHeader>
    
        <!--  Adding a blank page to cheat the shell core since it checks for default added item we are handling it in the extended shell element :-)  -->
        <ContentPage />
    
    
    </controls:ShellExtended>
    
  • NMackayNMackay GBInsider, University admin
  • JoannaGJoannaG Member ✭✭✭
    Hi @NMackay /@Colex,

    I am looking for the work around to make it work until its fixed. Can you please share possible solution for reported issue.
  • ColeXColeX Member, Xamarin Team Xamurai
    edited November 2020

    Your sample link seems to be broken .

Sign In or Register to comment.