ListViewPersistenceHelper 類別

定義

表示協助程式類別,用來儲存和擷取 ListView 的相對捲動位置。

public ref class ListViewPersistenceHelper sealed
/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class ListViewPersistenceHelper final
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class ListViewPersistenceHelper
Public NotInheritable Class ListViewPersistenceHelper
繼承
Object Platform::Object IInspectable ListViewPersistenceHelper
屬性

範例

如需完整的實作,請參閱 ListView 和 GridView 範例存放庫中還原卷動位置範例

備註

如果 ItemsStackPanel.ItemsUpdatingScrollMode 屬性設定為 KeepItemsInView,ListViewPersistenceHelper 會嘗試使用第一個可見專案的索引鍵來還原捲動位置。 如果 ItemsUpdatingScrollModeKeepLastItemInView,它會嘗試使用最後一個可見專案的索引鍵來還原卷動位置。

方法

GetRelativeScrollPosition(ListViewBase, ListViewItemToKeyHandler)

擷取 ListView 的相對捲動位置。

SetRelativeScrollPositionAsync(ListViewBase, String, ListViewKeyToItemHandler)

開始異步動作,以設定 ListView 的相對捲動位置。

適用於

另請參閱

  • <xref:Microsoft.UI.Xaml.Controls.ListView%0a%2b+%5bListView+and+GridView%5d(%2fwindows%2fuwp%2fcontrols-and-patterns%2flistview-and-gridview)>