开发者

WPF ListView arrow navigation and keystroke problem

开发者 https://www.devze.com 2023-03-04 08:21 出处:网络
I have a readonly WPF listView and I am having two problem with it (1) When I load the listView, I set the selecteditem in code behind. It works fine but when I use up/dowm arrow key to navigate thro

I have a readonly WPF listView and I am having two problem with it

(1) When I load the listView, I set the selecteditem in code behind. It works fine but when I use up/dowm arrow key to navigate through the list,开发者_运维技巧 it always jump to the first item at start.

(2) I can't use keystroke to select item

Can anyone give me some idea about how to solve them?

Thanks


Yes, the problem is you need to call Focus() on the list item after selecting it. But for various reasons it's not as simple as all that.

See Arrow keys don't work after programmatically setting ListView.SelectedItem

...for full details.

0

精彩评论

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

关注公众号