Skip to content

Latest commit

 

History

History
41 lines (26 loc) · 2.28 KB

itemsstackpanel_itemsupdatingscrollmode.md

File metadata and controls

41 lines (26 loc) · 2.28 KB
-api-id -api-type
P:Windows.UI.Xaml.Controls.ItemsStackPanel.ItemsUpdatingScrollMode
winrt property

Windows.UI.Xaml.Controls.ItemsStackPanel.ItemsUpdatingScrollMode

-description

Gets or sets a value that specifies scrolling behavior when the ItemsSource is updated.

-xaml-syntax

<ItemsStackPanel ItemsUpdatingScrollMode="itemsUpdatingScrollModeMemberName" />

-property-value

A value of the enumeration. The default is KeepItemsInView.

-remarks

This property controls how the ItemsStackPanel responds when the user has scrolled the items, and new items are added to the ItemsSource.

For example, if a user scrolls down a list of emails, and the ItemsSource updates, adding a new email to the top of the list:

  • If ItemsUpdatingScrollMode is KeepItemsInView, then the scroll offset is adjusted to keep the first visible item showing at the top of the view.
  • If ItemsUpdatingScrollMode is KeepScrollOffset, then the scroll offset relative to the top of the list is maintained. As a result, the items on the screen are pushed down to account for the new item added at the top.

In other cases, like in a chat app, items are added to the bottom of the list. In this case, you can set ItemsUpdatingScrollMode to KeepLastItemInView. This adjusts the scroll offset to keep the last visible item showing at the bottom of the view. (KeepLastItemInView is available starting with Windows 10, version 1607.)

Tip

In Windows 8, the ListView control uses VirtualizingStackPanel as its default ItemsPanel; in Windows 8.1, the ListView control uses ItemsStackPanel as its default ItemsPanel. When upgrading a ListView in a Windows 8 app to use ItemsStackPanel, set the ItemsUpdatingScrollMode property to KeepScrollOffset if you need to keep the behavior of the Windows 8 ListView.

-examples

-see-also