protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
 {
     // Before we navigate away from the page, we want to generate a new _persistedPosition string. This string contains the key of the item at the top of the
     // viewing window (generated by the function GetKey) and the offset of that item.
     RestoreScrollPositionSample._persistedPosition = ListViewPersistenceHelper.GetRelativeScrollPosition(this.ItemsListView, this.GetKey);
     base.OnNavigatingFrom(e);
 }
Ejemplo n.º 2
0
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            _persistedPosition = ListViewPersistenceHelper.GetRelativeScrollPosition(itemGridView, GetKey);
            base.OnNavigatingFrom(e);

            if (e.Cancel)
            {
                return;
            }
            if (e.NavigationMode == NavigationMode.Back)
            {
                _persistedPosition = null;
                var animation = ConnectedAnimationService.GetForCurrentView()
                                .PrepareToAnimate(CONNECTED_ANIMATION_HOSTED_CONFIG_NAME, hostedConfigNameTextBlock);
                if (ApiInformation.IsTypePresent("Windows.UI.Xaml.Media.Animation.DirectConnectedAnimationConfiguration"))
                {
                    animation.Configuration = new DirectConnectedAnimationConfiguration();
                }
            }
        }
Ejemplo n.º 3
0
 private void PersistControlsState()
 {
     try
     {
         TempSettingsUtils.Set(Constants.TEMP_PIVOT_STATE, MainPivot.SelectedIndex);
         if (this.SurahListView.ItemsPanelRoot != null)
         {
             TempSettingsUtils.Set(Constants.TEMP_SURAH_LIST_STATE, ListViewPersistenceHelper.GetRelativeScrollPosition(this.SurahListView, this.GetKeyFromListView));
         }
         if (this.JuzListView.ItemsPanelRoot != null)
         {
             TempSettingsUtils.Set(Constants.TEMP_JUZ_LIST_STATE, ListViewPersistenceHelper.GetRelativeScrollPosition(this.JuzListView, this.GetKeyFromListView));
         }
     }
     catch (Exception ex)
     {
         telemetry.TrackException(ex, new Dictionary <string, string> {
             { "Scenario", "PersistControlsState" }
         });
     }
 }
Ejemplo n.º 4
0
        public String GetState(Func <Object, String> itemToKeyFunction)
        {
            var itemToKeyHandler = (ListViewItemToKeyHandler)((item) => itemToKeyFunction.Invoke(item));

            return(ListViewPersistenceHelper.GetRelativeScrollPosition(this, itemToKeyHandler));
        }
 private void SaveScrollPosition()
 {
     // We let the item be its own key. In a more general program, the item would have
     // a unique ID that identifies it in the list.
     this.savedScrollPosition = ListViewPersistenceHelper.GetRelativeScrollPosition(BottomUpList, (o) => o.ToString());
 }
Ejemplo n.º 6
0
        protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
        {
            _persistedPosition = ListViewPersistenceHelper.GetRelativeScrollPosition(DuanListView, GetKey);

            base.OnNavigatingFrom(e);
        }