Arrow keys don't work after programmatically setting ListView.SelectedItem

前端 未结 9 1752
感情败类
感情败类 2020-12-16 02:34

I have a WPF ListView control, ItemsSource is set to an ICollectionView created this way:

var collectionView = 
  System.Windows.Data.CollectionViewSource.Ge         


        
9条回答
  •  萌比男神i
    2020-12-16 03:04

    Selecting an item programmatically does not give it keyboard focus. You have to do that explcitly... ((Control)listView1.SelectedItem).Focus()

提交回复
热议问题