Question

Is there any way for me to do this?

Was it helpful?

Solution

You can tell when the VerticalOffset changes by adding a handler to the ScrollViewer.ScrollChanged event to your TextBox. Something like this:

<TextBox AcceptsReturn="True" ScrollViewer.ScrollChanged="TextBox_ScrollChanged" />

The TextBox uses a ScrollViewer internally, so it's ScrollChanged event will bubble up to the TextBox (where you can handle it). The event arguments include information about what changed, such as the VerticalChange (the amount that the control has scrolled vertically).

private void TextBox_ScrollChanged(object sender, ScrollChangedEventArgs e) {
    System.Diagnostics.Debug.WriteLine(string.Format("************ {0}", e.VerticalChange));
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top