xamarin/Xamarin.Forms

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

开放

#6,214 创建于 2019年5月17日

 (4 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
a/listviewe/6 :clock6:help wantedinactivep/Androidt/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南