在Silverlight列表框中自动滚动 [英] Automatic Scrolling in a Silverlight List Box

查看:82
本文介绍了在Silverlight列表框中自动滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以编程方式强制将Silverlight列表框滚动到底部,以使最后添加的项目始终可见.

How can I programmatically force a silverlight list box to scroll to the bottom so that the last item added is always visible.

我尝试过简单地选择项目.它最终会显示为选中状态,但除非手动滚动到它,否则它仍然不可见.

I've tried simply selecting the item. It ends up as selected but still not visible unless you manually scroll to it.

推荐答案

使用传入最后一项的ListBox的ScrollIntoView方法.您可能需要立即调用UpdateLayout才能使其正常工作.

Use the ListBox's ScrollIntoView method passing in the last item. You may need to call UpdateLayout immediately before it for it to work.

这篇关于在Silverlight列表框中自动滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆