Use Smooth Scrolling Helpers to smooth scroll in ListViewBase(GridView, ListView).
- SmoothScrollIntoView Helper
- SmoothScrollNavigation Helper
- GetScrollViewer Helper
Use SmoothScrollIntoView Helper to scroll the item into the view with animation. Specify the ItemPosition property to align the item.
C#
// Scrolling with index
await MyGridView.SmoothScrollIntoViewWithIndex(index: int, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
// Scrolling with item
await MyGridView.SmoothScrollIntoViewWithItem(item: object, itemPlacement: ItemPlacement, disableAnimation: bool, scrollIfVisibile: bool, additionalHorizontalOffset: int, additionalVerticalOffset: int);
Methods | Return Type | Description |
---|---|---|
SmoothScrollIntoViewWithIndex(int, ItemPlacement, bool, bool, int, int) | Task | SmoothScrollIntoView With index number |
SmoothScrollIntoViewWithItem(object, ItemPlacement, bool, bool, int, int) | Task | SmoothScrollIntoView With item object |
Properties | Type | Description |
---|---|---|
intex | int | Intex of the item to be scrolled |
item | int | Intex of the item to be scrolled |
itemPosition | Enum | Specify the position of the Item after scrolling |
disableAnimation | bool | To disable the scrolling animation |
scrollIfVisibile | bool | Set true to scroll even if the scroll to item is visible so that the item will be aligned depend upon itemPosition |
additionalHorizontalOffset | bool | Give addition horizontal offset |
additionalVerticalOffset | bool | Give addition vertical offset |
ItemPosition | Description |
---|---|
Default | If visible then it will not scroll, if not then item will be aligned to the nearest edge |
Left | Aligned left |
Top | Aligned top |
Centre | Aligned centre |
Right | Aligned right |
Bottom | Aligned bottom |
Use SmoothScrollNavigation Helper to scroll the ListViewBase with buttons
listViewBase.SmoothScrollNavigation(100, ScrollNavigationDirection.Left, false);
Properties | Type | Description |
---|---|---|
ScrollAmount | int | Amount to be scrolled |
ScrollNavigationDirection | Enum | Direction of the scrolling |
DisableAnimation | bool | To disable the scrolling animation |
ScrollNavigationDirection | Description |
---|---|
Left | Scroll left |
Up | Scroll top |
Right | Scroll right |
Down | Scroll bottom |
Use GetScrollViewer Helper to get the ScrollViewer inside the ListViewBase
var scrollViewer = listViewBase.GetScrollViewer();