0
<GridView
                                    Grid.Row="1" 
                                    AutomationProperties.AutomationId="ItemGridView"
                                    AutomationProperties.Name="Grouped Items"
                                    ItemsSource="{Binding ServiceOrderList}"
                                    ItemTemplate="{StaticResource ServiceOrderListItemTemplate}"
                                    SelectedItem="{Binding SelectedServiceOrder, Mode=TwoWay}"
                                    IsSwipeEnabled="false">
                                    <winRtBehaviors:Interaction.Behaviors>
                                        <behaviors:EventToBoundCommandBehavior
                                            Command="{Binding ServiceOrderItemClickCommand}"
                                            Event="Tapped" />
                                    </winRtBehaviors:Interaction.Behaviors>

                                    <GridView.ItemsPanel>
                                        <ItemsPanelTemplate>
                                            <WrapGrid Orientation="Vertical" MaximumRowsOrColumns="3" />
                                        </ItemsPanelTemplate>
                                    </GridView.ItemsPanel>
                                </GridView>

我希望能够对gridview的项目进行左键单击,但不想让他们右键单击并选择一个项目,请帮忙。

4

2 回答 2

0

如果您根本不希望这些项目是可选的,请设置SelectionMode="None"IsItemClickEnabled="True"同时设置一个ItemClick事件。

如果您希望它们是可选择的,但只能左键单击,您可以设置IsRightClickEnabled="False".

于 2013-05-27T17:14:13.853 回答
0

另一种方法是将RightTapped事件放入您GridView.ItemTemplate的实施中:e.Handled = true

<GridView>
    <GridView.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="30,10"
                              Width="350" Tapped="Grid_Tapped_1" RightTapped="Grid_RightTapped">
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal">
                                    <Image Height="40" Source="{Binding Path=Image}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,-3,11,0"/>
                                    <TextBlock FontSize="24" FontWeight="SemiBold" FontFamily="Segoe WP" Foreground="#232323" Text="{Binding Path=RoomTypeString}" VerticalAlignment="Center"/>
                                </StackPanel>
                                <TextBlock FontSize="24" Text="{Binding Path=RoomCountString}"
                                        Foreground="#232323" FontFamily="Segoe WP"
                                        TextTrimming="CharacterEllipsis"/>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </GridView.ItemTemplate>
    </GridView>
于 2015-05-25T04:30:57.907 回答