<ScrollViewer VerticalScrollBarVisibility="Auto" >
<TextBlock Text="{Binding Status}"
HorizontalAlignment="Center" />
</ScrollViewer>
The Status always I’m adding to it, that is to say that in the code behind always I do this thing:
Status+= Environment.NewLine + "Hi";
And the ScrollViewer increasing, but the Status that I see is the first one, when I want to see the last one I need to scroll underneath to see it, my question is: how I can made the Scrollviewer scrolling underneath automaticaly?, that meaning I want always see the last status not the first.
Sorry about the broken english.
Name your ScrollViewer so you can access it in the code behind, like this:
Then you can do this:
With the way I do MVVM, I have access to my ViewModel from my View, so when the View first loads, I’d subscribe to the PropertyChanged event on my ViewModel as so:
and then in the ViewModelChanged callback I’d have this:
Every time the ViewModel’s Status property changes, the ScrollViewer will now scroll to end. Just remember to unsubscribe from MyViewModel.PropertyChanged when you leave that screen to avoid a memory leak.