By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,919 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

WPF ListView focus problem.

P: n/a
Hi everyone!

I have some strange behavior of ListView control in WPF.

We are developing application in C#.

I created ListView with some items and set SelectedIndex to some index in
the middle of its list. Then I clicked mouse at any place on the ListView and
then navigate with Up/Dows keyboard keys, everything works perfectly. But If
I move focus to another control and then tries to set focus back to ListView
control programmatically, then I'm getting the problem.

The ListView gets the focus, but when I’m trying to navigate with the
keyboard, current selection will be canceled and the first item will be
selected and navigation will start from the first item in list.

I'm setting focus to ListView control by calling to its .Focus() method.

It looks like even ListView control in focus, but no items actually in
focus, even if SelectedIndex has some valid values.

Please, help me! How can I set focus to ListView control programmatically to
prevent such behavior?



Mar 5 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.