开发者

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);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜