0

This is tedious and problematic.

I am trying to keyboard navigate (arrow down) to listview.item directly from another control. As some who had worked with this issue would already anticipate, the whole listview control gets focus first and then one more arrow down key will select the item.

There were some solutions out there to solve this issue, however I have to bring focus back out to another control with arrow up key stroke, which doesn't have clear solution yet.

Closest approach to this issue was posted here: http://cytivrat.blogspot.com/2011/05/selecting-first-item-in-wpf-listview.html

But this one doesn't solve keystrokes behave differently.

I would expect much simpler and clean solution as if setting one property to true/false does the job.

swcraft
  • 2,014
  • 3
  • 22
  • 43
  • 1
    If it's not as simple as the above (think it will prevent you from selecting the items, but I could be mistaken)... I think you'll have to manage it from within the control acting as a container for all these other controls, in the keyup/down events; manually skipping the listview and manually determining the control 'above' it. – Greg B Aug 21 '13 at 18:05
  • @JP_medevice right. I misunderstood your question. – Federico Berasategui Aug 21 '13 at 18:19
  • @Greg you are right except I have to deal with the Item which is 'below' the listview. Any suggestion to solve? – swcraft Aug 21 '13 at 18:33

1 Answers1

-1

It seems the keyboard is not focused when you try to use the navigation keys. I was just dealing this one with the gridview but this answer solved the issue all you need to do is i guess set the focus using Dispatcher. In my case the grid was being focused but i was not able to use arrow keys to navigate through the rows.

  Dispatcher.BeginInvoke(
        DispatcherPriority.ContextIdle,
        new Action(delegate()
        {
            ItemsFlowListBox.Focus();
            ItemsFlowListBox.ScrollIntoView(ItemsFlowListBox.SelectedItem);
        }));
Community
  • 1
  • 1
Nivid Dholakia
  • 5,272
  • 4
  • 30
  • 55
  • sorry although this could be good solution for people who don't have the keyboard focus, that's not my question. My question is two focuses listview has in its nature, one for whole listview then listview.item. I can't get to second one directly naturally – swcraft Aug 21 '13 at 19:05