public void myListView_ItemClick(object sender, ItemClickEventArgs e) { // Get the clicked item var selectedItem = (MyDataItem)e.ClickedItem; // Do something with the selected item // ... }
public void myGridView_ItemClick(object sender, ItemClickEventArgs e) { // Get the clicked item var selectedItem = (MyDataItem)e.ClickedItem; // Do something with the selected item // ... }This example is similar to the first one, but this time we have a GridView control named "myGridView". We attach the "myGridView_ItemClick" method to the GridView's "ItemClick" event. When a user clicks on an item in the GridView, the "myGridView_ItemClick" method is called and we can access the clicked item through the "ClickedItem" property of the ItemClickEventArgs. Package library: Windows.UI.Xaml.Controls