// Save the session state var sessionState = MyApp.Utilities.SessionState[this._pageTitle]; if (!sessionState) { sessionState = { focusedItem: null, scrollPosition: 0 }; MyApp.Utilities.SessionState[this._pageTitle] = sessionState;
} var currentItem = null; var scrollPosition = 0; try { // Querying the currentItem can throw if listView is loading items from a new dataSource currentItem = this._allItemsListView.currentItem; scrollPosition = this._allItemsListView.scrollPosition; } catch (e) { // Do nothing // Just save the default values }