Reputation: 341
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
Upvotes: 2
Views: 3363
Reputation: 192597
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.
Upvotes: 2