How call some function when User scroll ListBox to end?
I try ro use ScrollToBottom bit this doesn't work!
0
votes
3 Answers
0
votes
0
votes
This works. Set the ListBox to not scroll, then add a ScrollViewer around it. Now in your code behind you can set the ScrollViewer to whatever you want.
XAML:
<!--Disable the ListBox scroll and add a ScrollViewer so we have control over the scroll position.-->
<ScrollViewer
Name="scrlvwrListBoxMessages"
VerticalScrollBarVisibility="Auto" >
<ListBox x:Name="lstbxMessages"
ScrollViewer.VerticalScrollBarVisibility="Disabled" >
</ListBox>
</ScrollViewer>
Code:
private void ScrollToBottom()
{
//Scroll to the bottom.
Dispatcher.BeginInvoke(() =>
{
this.scrlvwrListBoxMessages.ScrollToVerticalOffset(double.MaxValue);
});
}
-1
votes
There is no method named "ScrollToBottom" in Silverlight ListBox
Try this :
myListBox.ScrollIntoView(myListBox.Items.Count);