private void listView1_ItemClick(object sender, ItemClickEventArgs e) { // Get the clicked item ListViewItem clickedItem = listView1.Items[e.Index]; // Do something with the clicked item Console.WriteLine("Clicked item: " + clickedItem.Text); }
private void comboBox1_ItemClick(object sender, ItemClickEventArgs e) { // Get the clicked item ComboBoxItem clickedItem = comboBox1.Items[e.Index]; // Do something with the clicked item if (clickedItem.IsChecked) { Console.WriteLine("Item \"" + clickedItem.Content + "\" is checked."); } }In this example, we handle the click event of a ComboBox control by getting the clicked item from the event arguments, and then checking its IsChecked property to determine whether it is selected or not. The ItemClickEventArgs class is part of the Windows.UI.Xaml.Controls namespace, which is included in the Windows Runtime (WinRT) library for building Windows Store apps using C#.