开发者

How to disable ListView navigation through keyboard

开发者 https://www.devze.com 2022-12-26 23:21 出处:网络
Can I somehow disable ListView items navigation through keyboard (arrow ke开发者_StackOverflowys), and leave navigation with mouse and in code? Im new to WPF, but have some experience with WinForm so

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消