Search code examples
c#xamlwindows-8

How to get tapped item in gridview


I want to get the tapped item in my gridview, but I can't use itemclick event with some reason, after get the item, I also want to convert it as an object which the item hold. The gridview had DataTemplate, when I see the e.OriginalSource value in tapped event, it is a TextBlock. Anyone can help?


Solution

  • I answered a similar question here:

    Windows 8 Metro: How to get clicked GridViewItem?

    If you're trying to get the GridViewItem object for the item the user clicked on, this can be captured by the GridView's ItemClick event by using the GridView's ItemContainerGenerator.ContainerFromItem method.