How to Detect Scrolling to the Bottom in UWP DOCX Editor
30 Aug 20261 minute to read
This page explains how to identify whether the viewer is scrolled to the bottom in the UWP SfRichTextBoxAdv control.
Detecting scroll-to-bottom
SfRichTextBoxAdv exposes the document scroll bars through the VerticalScrollBar and HorizontalScrollBar properties of the SfRichTextBoxAdv class. Using these properties, you can detect when the document is scrolled to the bottom of the control.
Use the ValueChanged event of the VerticalScrollBar for this purpose. Check whether the scroll bar’s value equals the VerticalScrollBar.Maximum value; if so, the vertical scroll bar has been scrolled to the bottom of the control.
The following code example illustrates how to identify whether the viewer is scrolled to the bottom of SfRichTextBoxAdv.
/// <summary>
/// Occurs when the SfRichTextBoxAdv is loaded and ready for interaction.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The RoutedEventArgs instance containing the event data.</param>
private void RichTextBoxAdv_Loaded(object sender, RoutedEventArgs e)
{
if (richTextBoxAdv.VerticalScrollBar != null)
{
richTextBoxAdv.VerticalScrollBar.ValueChanged += VerticalScrollBar_ValueChanged;
}
}
/// <summary>
/// Occurs when the vertical scroll bar value changes.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The RangeBaseValueChangedEventArgs instance containing the event data.</param>
private void VerticalScrollBar_ValueChanged(object sender, RangeBaseValueChangedEventArgs e)
{
// When the scroll bar value equals its Maximum, the scroll has reached the bottom of the control.
if (e.NewValue == richTextBoxAdv.VerticalScrollBar.Maximum)
{
// Add your "reached the bottom" logic here.
}
}