Identify whether the viewer is scrolled to the bottom in the UWP SfRichTextBoxAdv

3 Apr 20231 minute to read

This page explains how to identify whether the viewer is scrolled to the bottom in Syncfusion UWP SfRichTextBoxAdv.

SfRichTextBoxAdv scrollbars can be accessed through the VerticalScrollBar and HorizontalScrollBar properties of SfRichTextBoxAdv class. Using these properties, we can identify when the document is scrolled to the bottom of the control.

We can use the ValueChanged event of the VerticalScrollBar for this purpose. Check if the scroll bar’s value equals the VerticalScrollBar Maximum property value, if these values are equal then the vertical scroll bar has been scrolled to the bottom of the control.

The following code example illustrates to identify whether the viewer is scrolled to the bottom of the SfRichTextBoxAdv.

/// <summary>
///  Occurs when the element is laid out, rendered, 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 vertical scrollbar value is changed.
/// </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)
 {
     if (e.NewValue == richTextBoxAdv.VerticalScrollBar.Maximum)
     {
             ///When the scroll bar value and its maximum value are same.
             ///Then scroll reached the bottom of the control.
     }
 }