开发者

WPF ListView arrow navigation and keystroke problem

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜