using System.Windows.Controls; namespace Titano.App.Sections; public partial class LibraryView : UserControl { public LibraryView() => InitializeComponent(); /// Loads the next page when the grid or the list scrolls within two screens of its end. private void OnScrollChanged(object sender, ScrollChangedEventArgs e) { if (DataContext is not LibraryViewModel vm || e.ExtentHeight <= 0) return; if (e.VerticalOffset + e.ViewportHeight >= e.ExtentHeight - 2 * Math.Max(e.ViewportHeight, 200)) _ = vm.LoadMoreAsync(); } }