views:

31

answers:

2

I have a databound listbox, and when i add new items to the top of the list, the scrollviewer maintains position, but the items i was looking at are pushed further down out of view.

Has anyone found a way to maintain the relative viewpoint as items are added?

A: 

Could you try doing something with:

listBox1.ScrollIntoView(listBox1.SelectedItem);
Matt Lacey
There are 3 issues there. 1) It assumes i have a selected item. 2) It requires knowing what items are currently visible, 3) It would probably result in "jumping". I'm hoping for a seamless way to do this. Thanks for the suggestion though!
midas06
A: 

You could get the vertical offset of the scrollviewer's scrollbar, add your items, then restore the offset?

John Gardner