I am working on a WPF ListView and I want to use the keyboard navigation which actually works fine right now. The problem is as follows:
- I listen to SelectionChanged on the ListBox
- inside the event handler I bring the selected Item into view (which works fine)
- when I start Keyboard navigation it starts from the top of the list, not from the SelectedItem (which is the thing i don't want).
So the question is now: how can I start keyboard navigation (up and down arrows) from the SelectedItem instead of the first Item?
Here ist what my event handler looks like:
protected void ListSelectionChanged
( Object sender
, SelectionChangedEventArgs args )
{
var enumerator = args.AddedItems.GetEnumerator( );
if ( enumerator.MoveNext( ) )
( sender as ListView ).ScrollIntoView( enumerator.Current );
}
Thx in advance!