Navigate to specific element in long list selector after binding

I am using Longlistselector to bind chat messages. After binding, I need to show the latest message. But by default it goes to the beginning of the message. I tried scrolling to the last item "(ScrollTo (lastmessage))" but it doesn't work. can anyone provide a solution.


source to share

3 answers

Others have succeeded by calling UpdateLayout () before ScrollIntoView () in the ListBox.



You tried AnimateTo()

and passed the last item in the list to it.

Alternatively, you can poll the control's visual tree and access the ScrollViewer of the inner [Templated] ListBox and call ScrollToVerticalOffset




Try setting the SelectedItemIndex to the index of the last item.



All Articles