xamarin/Xamarin.Forms

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

Aperta

#6214 aperta il 17 mag 2019

 (4 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/listviewe/6 :clock6:help wantedinactivep/Androidt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor