ListCollectionView navigates to newly created record

When using ListCollectionView, how do I bring focus to the newly created record? my announcements

Public WithEvents Data As PersonList = PersonList.GetList()
Private MyView As New ListCollectionView(Data)
Private WithEvents _Person As Person

      

The code I am using to insert the person is

    _Person = New Person("AAAA", 100)
    Data.Insert(0, _Person)

      

I tried to use MyView.MoveCurrentTo (Dunno what to add here) but nothing works.

If I was working with a basic ObservableCollection, I would go for index 0, but I cannot rely on that as the ListCollectionView can be sorted and filtered so that the entries are no longer in the same order as the ObservableCollection.

0


a source to share


1 answer


Have you tried this?

MyView.MoveCurrentTo(MyView.CurrentAddItem)

      



You can also use MyView.AddNew to add a new item, I suspect it makes it current.

Also, don't forget to set IsSynchronizedWithCurrentItem to True on your ItemsControl

0


a source







All Articles