How to keep relative position in a listbox when new items are added
I have a databo开发者_如何学编程und 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?
You could get the vertical offset of the scrollviewer's scrollbar, add your items, then restore the offset?
Could you try doing something with:
listBox1.ScrollIntoView(listBox1.SelectedItem);
精彩评论