获取AdaptiveGridView UWP中的tapped项的索引

时间:2016-09-08 18:08:29

标签: c# xaml uwp

有没有办法可以获得AdaptiveGridView工具包中的tapped项的索引。 继承我的代码: 页面资源:

JMenu

XAML:

JPopupMenu menu1 = new JPopupMenu();
menu1.add(new JMenuItem("Item1"));
menu1.add(new JMenuItem("Item2"));
countItems(menu1);
JMenu menu2 = new JMenu();
menu2.add(new JMenuItem("Item1"));
menu2.add(new JMenuItem("Item2"));
countItems(menu2.getPopupMenu());//Use the JPopupMenu rather than the JMenu itself)

private static final void countItems(JPopupMenu menu){
    System.out.println("COUNT: " + menu.getComponents().length);
}

代码背后:

<Page.Resources>
    <DataTemplate x:Key="Photos">
        <Grid>
            <Image Source="{Binding ImageURL}"
                       Stretch="UniformToFill"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
            </Image>
            <TextBlock Text="{Binding ImageText}"
                       FontSize="20">
            </TextBlock>
        </Grid>
    </DataTemplate>
</Page.Resources>

我希望得到我点击的项目的索引。有没有办法做到这一点?

1 个答案:

答案 0 :(得分:0)

  

我希望得到我点击的项目的索引。有没有办法做到这一点?

是的,你可以在The specified host network collides with a non-hostonly network! This will cause your specified IP to be inaccessible. Please change the IP or name of your host only network so that it no longer matches that of a bridged or non-hostonly network. 中获得点击的项目及其索引:

vagrant global-status