private string GetKey(object item) { // This function takes in the item at the top of the viewport at the moment of navigating away from the page, and returns // a key corresponding to that item. the implementation of this function is dependent on the data model you are using. In this // function we also save the fully rendered _persistedItemContainerHeight. You do not need to do this if all of your items have // the same fixed height. Finally, we save the key into a variable so it can be used outside of ListViewPersistenceHelper functions var singleItem = item as Item; if (singleItem != null) { _persistedItemContainerHeight = (ItemsListView.ContainerFromItem(item) as ListViewItem).ActualHeight; _persistedItemKey = singleItem.Id; return(_persistedItemKey); } else { return(string.Empty); } }