コード例 #1
0
 private void ItemGridViewOnLoaded(object sender, RoutedEventArgs routedEventArgs)
 {
     if (_horizontalOffset != null)
     {
         ScrollViewerHelpers.ScrollToHorizontalOffset(itemGridView, _horizontalOffset.Value);
     }
 }
コード例 #2
0
        protected override void SaveState(Dictionary <String, Object> pageState)
        {
            DataTransferManager.GetForCurrentView().DataRequested -= OnDataRequested;

            var state = ViewModel.SaveState();

            double offset = ScrollViewerHelpers.GetHorizontalOffset(itemGridView);

            state.GridViewHorizontalOffset = offset;

            string serializedState = SerializationHelper.SerializeToString(state);

            pageState[Constants.SearchResultsPageState] = serializedState;
        }
コード例 #3
0
ファイル: MainPage.xaml.cs プロジェクト: ballance/winrt-ris
        // NOT IN USE BECAUSE: when returning from a search, a new item is added at the top, thus making the previous scroll position invalid
        private void ScrollListViewsToSavedPosition()
        {
            // If the controls weren't loaded, accessing them will cause crashes
            if (!_pastOnLoaded)
            {
                return;
            }

            if (null != _historyVerticalOffset && ViewModel.SearchHistory != null)
            {
                ScrollViewerHelpers.ScrollToVerticalOffset(searchHistoryListView, _historyVerticalOffset.Value);
            }

            if (null != _downloadsVerticalOffset && ViewModel.DownloadedDocuments != null)
            {
                ScrollViewerHelpers.ScrollToVerticalOffset(downloadsListView, _downloadsVerticalOffset.Value);
            }
        }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: ballance/winrt-ris
        protected override void SaveState(Dictionary <String, Object> pageState)
        {
            MessengerHelper.Unregister(this, MessengerHelper.SearchHistoryDeleted);
            MessengerHelper.Unregister(this, MessengerHelper.DownloadsDeleted);
            MessengerHelper.Unregister(this, MessengerHelper.DbLoadCompleted);

            var state = ViewModel.SaveState();

            state.SearchHistoryVerticalOffset = ScrollViewerHelpers.GetVerticalOffset(searchHistoryListView);
            state.DownloadsVerticalOffset     = ScrollViewerHelpers.GetVerticalOffset(downloadsListView);

            string serializedState = SerializationHelper.SerializeToString(state);

            pageState[Constants.MainPageState] = serializedState;

            // OnNavigatedFrom would be called *before* SaveState (unless we call base. first), that's why we destroy the references here
            DataContext = null;
            ViewModel   = null;
        }