WPF ListView/Gridview keyboard handling

L

Lloyd Sheen

I have a strange WPF problem with a Listview. The listview contains a list
of media files. The first column of GridView is a button which when clicked
causes the media selected to play within the app.

Clicking the button will set the selected index/item of the listview
corrrectly (I have a label I am now using to debug and are showing the
listview.selectedindex).

If I populate the listview I can use the down arrow to navigate the listview
with the following problems:

1. The first down arrow press does nothing, the second is handled (I have
no code for handling the key strokes so this is WPF behaviour. This happens
each time the listview is populated. I set the listview.selecteditem to
nothing in the populate code.

2. If I click the button for one of the items and then click the down
arrow the selected item has been changed to -1 (I do not do this in code and
the populate (see above) is not called. In the button click I set the
selected item

Why does the selectedindex/item change without my/user guidance?

There is lots of code. If needed I will post.

Thanks
Lloyd Sheen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top