Automatic Scrolling in a Silverlight List Box

前端 未结 4 1243
情歌与酒
情歌与酒 2020-12-18 21:46

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

4条回答
  •  温柔的废话
    2020-12-18 22:18

    Slightly refactored to reduce the lines of code:

     listBoxEvents.Add(item)
     listBoxEvents.UpdateLayout()
     listBoxEvents.ScrollIntoView(listBoxEvents.Items(listBoxEvents.Items.Count - 1))
    

提交回复
热议问题