public void ResetScroll() { if (scroller) { itemListScrollBar.Reset(listDisplayUnits); } }
int GetSafeScrollIndex(VerticalScrollBar scroller, bool delayScrollUp) { // Get current scroller index int scrollIndex = scroller.ScrollIndex; if (scrollIndex < 0) { scrollIndex = 0; } // Ensure scroll index within current range if (!delayScrollUp && scrollIndex + scroller.DisplayUnits > scroller.TotalUnits || scrollIndex >= scroller.TotalUnits) { scrollIndex = scroller.TotalUnits - scroller.DisplayUnits; if (scrollIndex < 0) { scrollIndex = 0; } scroller.Reset(scroller.DisplayUnits, scroller.TotalUnits, scrollIndex); } return(scrollIndex); }
/// <summary> /// Gets safe scroll index. /// Scroller will be adjust to always be inside display range where possible. /// </summary> int GetSafeScrollIndex(VerticalScrollBar scroller) { // Get current scroller index int scrollIndex = scroller.ScrollIndex; if (scrollIndex < 0) scrollIndex = 0; // Ensure scroll index within current range if (scrollIndex + scroller.DisplayUnits > scroller.TotalUnits) { scrollIndex = scroller.TotalUnits - scroller.DisplayUnits; if (scrollIndex < 0) scrollIndex = 0; scroller.Reset(scroller.DisplayUnits, scroller.TotalUnits, scrollIndex); } return scrollIndex; }