By default, ListBox scrolls on an item-by-item basis. Because the scrolling is based on each
item’s height, it can look quite choppy if you have large items. If you want smooth scrolling,
such that each scrolling action shifts the items by a small number of pixels regardless of
their heights, the easiest solution is to set the ScrollViewer.CanContentScroll attached
property to false on the ListBox. Be aware, however, that by making this change you lose ListBox’s virtualization functionality. Virtualization refers to the optimization of creating child elements only when they become visible on the screen. Virtualization is only possible when using data binding to fill the control’s items, so setting CanContentScroll to false can negatively impact the performance of data-bound scenarios only.
No comments:
Post a Comment