Andrew
Andrew

Reputation: 1102

How to disable ListView navigation through keyboard

Can I somehow disable ListView items navigation through keyboard (arrow keys), and leave navigation with mouse and in code? Im new to WPF, but have some experience with WinForm so any tips?

Upvotes: 2

Views: 2838

Answers (1)

Steav
Steav

Reputation: 1486

Register the listView_PreviewKeyDown Event and set

    private void listView1_PreviewKeyDown(object sender, KeyEventArgs e)
    {
        e.Handled = true;
    }

For further infos on the pressed key (e.g. to disable only special keys) check the KeyEventArgs e.

Upvotes: 5

Related Questions