xamarin/Xamarin.Forms

Listview itemtapped not working if there is any button or any event control inside in android

Ouverte

#6 214 ouverte le 17 mai 2019

 (4 commentaires) (0 réaction) (0 personne assignée)C# (1 926 forks)batch import
a/listviewe/6 :clock6:help wantedinactivep/Androidt/bug :bug:up-for-grabs

Métriques du dépôt

Stars
 (5 644 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Listview itemtapped not working if there is any button or any event control inside.Any help is highly helpful.Thanks is advance.

`

<ListView ItemsSource="{Binding ListCheckBox}"
                                  ItemTapped="FlowListView_FlowItemTapped"
                                  SeparatorVisibility="None" 
                                  RowHeight="120"
                                  HasUnevenRows="True"
                                  HorizontalOptions="Center"
                                  VerticalOptions="Center"
                                  SeparatorColor="Transparent"
                                  BackgroundColor="Transparent"
                                                      >
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>
                    <StackLayout Spacing="0">
                        <ctlr:TestView MenuTitle="{Binding MenuTitle}"
                                                           IsToggled="{Binding IsToggled, Mode=TwoWay}" 
                                                           SelectOptionValue="{Binding SelectOptionValue,Mode=TwoWay}"
                                                           Margin="0,5,0,20"/>
                        <Editor x:Name="TxtComment" HeightRequest="70" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" Placeholder="What is your action?"   TextColor="#58595B" IsVisible="{Binding IsCommentBoxVisible}" Text="{Binding Comment}" BackgroundColor="White" FontSize="Small"/>
                    </StackLayout>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

//Code for the view
<ContentView.Content>
       <Grid Margin="0,5,0,0">
           <Grid.RowDefinitions>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
               <RowDefinition Height="Auto"/>
           </Grid.RowDefinitions>
           <Grid.ColumnDefinitions>
               <ColumnDefinition Width="60*"/>
               <ColumnDefinition Width="40*"/>
           </Grid.ColumnDefinitions>
           <Label Text="{Binding MenuTitle}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
           <control:SegmentedControl 
               Grid.Row="1"
               Grid.Column="0"
               x:Name="SegmentedControl" 
               TintColor="#00a2db"
               SelectedTextColor="White"
               DisabledColor="Gray"
               SelectedSegment="{Binding SelectOptionValue,Mode=TwoWay}">
               <control:SegmentedControl.Children>
                   <control:SegmentedControlOption Text="Safe"/>
                   <control:SegmentedControlOption Text="Unsafe"/>
                   <control:SegmentedControlOption Text="N/A"/>
               </control:SegmentedControl.Children>
           </control:SegmentedControl>
           <flex:FlexButton
                   Grid.Row="1"
                   Grid.Column="1"
                   HorizontalOptions="Center"
                   CornerRadius="5"
                   BorderColor="Gray"
                   HighlightBorderColor="#00a2db"
                   Text="Feedback Given"
                   ToggleMode="true"
                   FontSize="10"
                   IsToggled="{Binding IsToggled}"
                   ForegroundColor="Black"
                   HighlightForegroundColor="#ffffff"
                   BackgroundColor="#ededed"
                   HighlightBackgroundColor="#00a2db"/>
           <Button Text="Try me"  Grid.Row="2"
                   Grid.Column="0" Grid.ColumnSpan="2" />
       </Grid>
   </ContentView.Content>

`

If i use button also same issue is reproducible easily.One main point the issue i observed in android only did not tested IOS till now.

Expected behavior The Itemtapped event should fire

Basic Information Xamarin forms : 3.4.0.1008975 and below upto 3.1 Platform: Android

Guide contributeur