图像在GridView内部轻敲

时间:2016-01-05 12:41:09

标签: c# xaml gridview windows-runtime winrt-xaml

我有GridView喜欢这个

<GridView ItemsSource="{Binding PublicLibraries}" SelectionMode="None" IsItemClickEnabled="True"
                          ItemClick="OnPublicLibrariesItemTapped" x:Name="PublicLibrariesGridView"
                          Margin="24 0" ItemsPanel="{StaticResource LibraryItemsPanelTemplate}"
                          ItemTemplate="{StaticResource LibraryDataTemplate}" />

DataTemplate就是这样的

<DataTemplate x:Key="LibraryDataTemplate">
            <Grid Width="510" Height="300">
                <StackPanel Orientation="Horizontal" Background="Black" Opacity="0.8" VerticalAlignment="Bottom">
                    <TextBlock Style="{StaticResource TitleTextBlockStyle}" Foreground="White"
                               Text="{Binding LibName}" Margin="12" Width="450"/>
                    <Image HorizontalAlignment="Left" Margin="12 6" Width="24" Height="36"
                           Source="ms-appx:///Assets/Logo.png" Stretch="UniformToFill"
                           Tapped="OnDetailLibraryTapped" />
                </StackPanel>
            </Grid>
        </DataTemplate>

我现在想要的是当用户点击图像时,它应首先触发OnDetailLibraryTapped。但是现在当我点击图片时,它仍然会触发OnPublicLibrariesItemTapped。当用户点按图片或GridView本身时,我如何区分?

0 个答案:

没有答案