Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Adding an item to a ListBox moves the focus off the selected item

$
0
0

When an item is added to a ListBox through an ObservableCollection / CollectionView and another item was selected and focused (you can see the keyboard focus rectangle around the item), then the focus moves away from the item and the entire ListBox control gets focused instead (you can see the keyboard focus rectangle around the entire ListBox control).

That obviously breaks keyboard navigation because when an item is added while the user is going through the items with the arrow keys, the selection is reset to the first item.

Why is the focus moved away from the selected item and how can I stop that? The focused and selected item must remain the same after new items are added to the list.

Using .NET 4.0


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>