Listview and itemClick event

0
0

Ciao

how do I click an element of the listview with the Enter key of the keyboard?

Grazie
  • You must to post comments
0
0

Hi Messere,

You can add a KeyPress event handler to your ListView, it would look like this:

private void listView1_KeyPress(object sender, KeyPressEventArgs e)
{
    if (e.KeyChar == (char)Keys.Enter)
    {
        var selected = this.listView1.SelectedItems[0];
        AlertBox.Show($"Selected {selected.Text}");
    }
}

Please let me know if you have any questions about it!

 

Best,

Levie

 

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.