Xamarin、TapGestureRecognizer 不起作用

问题描述

我不明白为什么 TapGestureRecognizer Command = "{Binding PointViewCommand}" CommandParameter = "{Binding Start.RoutePoint}" 似乎重叠了一些东西。我抓住那里的按钮,按钮点击。如果我在 ScrollView 之后将 TapGestureRecognizer 放入第一个 StackLayout 中,它可以工作,但它不适合我,因为有一个列表,我需要单击特定记录。

<ScrollView IsVisible="{Binding IsSetActiveRoute}" IsEnabled="{Binding IsSetActiveRoute}" InputTransparent="True">
        <StackLayout  BindableLayout.ItemsSource="{Binding RouteListDoc.RowsRoute}" Padding="5">
            <BindableLayout.ItemTemplate>
                <DataTemplate>
                    <Frame CornerRadius="5"  OutlineColor="#c3c3c3" BackgroundColor="#F2FFFFE0">
                        <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand">

                            <StackLayout Orientation="Horizontal">

                                <StackLayout HorizontalOptions="StartAndExpand" WidthRequest="125">
                                    <StackLayout.GestureRecognizers>
                                        <TapGestureRecognizer Command="{Binding PointViewCommand}" CommandParameter="{Binding Start.RoutePoint}" />
                                    </StackLayout.GestureRecognizers>

                                    <Label Text="{Binding Start.RoutePoint}" FontAttributes="Bold" FontSize="Large"/>
                                    <Label Text="Вікно доставки:" FontSize="Medium" FontAttributes="Bold" />
                                    <Label Text="{Binding Start.Windows}" FontSize="Medium" />
                                </StackLayout>

                                <StackLayout HorizontalOptions="StartAndExpand" WidthRequest="80">
                                    <Image Source="arrow.png" HorizontalOptions="CenterandExpand"  />
                                    <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
                                        <Label Text="Пал:" FontSize="Medium" FontAttributes="Bold" />
                                        <Label Text="{Binding Finish.Pal}" FontSize="Medium" />
                                    </StackLayout>
                                    <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
                                        <Label Text="КГ:" FontSize="Medium" FontAttributes="Bold" />
                                        <Label Text="{Binding Finish.KG}" FontSize="Medium" />
                                    </StackLayout>
                                    <StackLayout Orientation="Horizontal" HorizontalOptions="Center">
                                        <Label Text="КМ:" FontSize="Medium" FontAttributes="Bold" />
                                        <Label Text="{Binding Start.KM}" FontSize="Medium" />
                                    </StackLayout>
                                </StackLayout>

                                <StackLayout HorizontalOptions="EndAndExpand" WidthRequest="125">
                                    <Label Text="{Binding Finish.RoutePoint}" FontAttributes="Bold" FontSize="Large" />
                                    <Label Text="Вікно доставки:" FontSize="Medium" FontAttributes="Bold" />
                                    <Label Text="{Binding Finish.Windows}" FontSize="Medium" />
                                </StackLayout>
                            </StackLayout>
                        </StackLayout>
                    </Frame>
                </DataTemplate>
            </BindableLayout.ItemTemplate>
        </StackLayout>
    </ScrollView>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)