C# 找到什么';在HubSection GridView数据模板中选择

C# 找到什么';在HubSection GridView数据模板中选择,c#,windows-8,windows-runtime,winrt-xaml,windows-8.1,C#,Windows 8,Windows Runtime,Winrt Xaml,Windows 8.1,我有以下代码组成轮毂中的轮毂部分 <HubSection DataContext="{Binding Path=[0], Source={StaticResource groupedItemsViewSource}}" Padding="40,30,40,0"> <HubSection.Background> <ImageBrush ImageSource="Images/BG.jpg"

我有以下代码组成
轮毂
中的
轮毂部分

            <HubSection DataContext="{Binding Path=[0], Source={StaticResource groupedItemsViewSource}}" Padding="40,30,40,0">
            <HubSection.Background>
                <ImageBrush ImageSource="Images/BG.jpg" Stretch="UniformToFill" />
            </HubSection.Background>
            <HubSection.Header>
                <TextBlock x:Uid="Section1Header" TextLineBounds="TrimToBaseline" OpticalMarginAlignment="TrimSideBearings" Text="English"/>
            </HubSection.Header>
            <DataTemplate>
                <GridView
                    x:Name="itemGridView1"
                    Margin="-4,-4,0,0"
                    AutomationProperties.AutomationId="ItemGridView"
                    AutomationProperties.Name="Items In Group"
                    ItemsSource="{Binding Items}"
                    ItemTemplate="{StaticResource Standard240x320ItemTemplate}"
                    SelectionMode="Single"
                    IsSwipeEnabled="false"
                    IsItemClickEnabled="True"
                    ItemClick="ItemView_ItemClick">
                </GridView>
            </DataTemplate>
        </HubSection>

我也设置了AppBar,但我不知道如何告诉AppBar在Hubb部分中选择了什么

请告知


编辑:为了澄清,我在实现代码时遇到了一些问题,例如
itemGridView1.selectedItem
,因为我被告知它“在当前上下文中不存在”。

关于这个问题的大多数建议都集中在遍历框架的可视化树上,但在XAML Hub部分,这似乎不太管用

相反,在GridView中实现SelectionChanged事件。触发此选项后,它将发送GridView发件人的详细信息,然后可以引用该发件人以获取其他信息,如.SelectedItem

private void GridViewName_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
    var GridState = sender as GridView;
    if(GridState.SelectedItems.Count>0)
    {
        // Do something
    }
}

不知怎的,这个事件没有为我启动工作,我被迫更改为ItemClick事件。。。