Пример #1
0
 protected virtual SnapManager GetSnapManager()
 {
     if (_snapManager == null)
     {
         _snapManager = new SnapManager(ItemsLayout, this);
     }
     return(_snapManager);
 }
Пример #2
0
        protected virtual void TearDownOldElement(ItemsView oldElement)
        {
            if (oldElement == null)
            {
                return;
            }

            // Stop listening for layout property changes
            if (ItemsLayout != null)
            {
                ItemsLayout.PropertyChanged -= LayoutPropertyChanged;
            }

            // Stop listening for property changes
            oldElement.PropertyChanged -= OnElementPropertyChanged;

            // Stop listening for ScrollTo requests
            oldElement.ScrollToRequested -= ScrollToRequested;

            RemoveScrollListener();

            if (ItemsViewAdapter != null)
            {
                // Stop watching for empty items or scroll adjustments
                _emptyCollectionObserver.Stop(ItemsViewAdapter);
                _itemsUpdateScrollObserver.Stop(ItemsViewAdapter);

                // Unhook whichever adapter is active
                SetAdapter(null);

                _emptyViewAdapter?.Dispose();
                ItemsViewAdapter?.Dispose();
            }

            if (_snapManager != null)
            {
                _snapManager.Dispose();
                _snapManager = null;
            }

            if (_itemDecoration != null)
            {
                RemoveItemDecoration(_itemDecoration);
            }
        }
Пример #3
0
        protected virtual void UpdateSnapBehavior()
        {
            _snapManager = GetSnapManager();

            _snapManager.UpdateSnapBehavior();
        }