Piter Stockman
Piter Stockman

Reputation: 25

How to avoid scroll after adding element into ListBox?

My collection:

private ObservableCollection<Data> listData;

ListBox source:

ListBoxData.ItemsSource = listData;  

Later i add elements 20 times at start of collection: ListBoxData.Insert(0, new Data());

After adding ListBox scrolls to first element of collection. How to disable scrolling after adding?

Upvotes: 1

Views: 180

Answers (1)

Amir
Amir

Reputation: 643

does this one works for you? ListBox .SelectedIndex = 0;

Upvotes: 1

Related Questions