Ejemplo n.º 1
0
        /// <summary>
        /// Creates an <see cref="ItemVirtualizer"/> based on an item presenter's
        /// <see cref="ItemVirtualizationMode"/>.
        /// </summary>
        /// <param name="owner">The items presenter.</param>
        /// <returns>An <see cref="ItemVirtualizer"/>.</returns>
        public static ItemVirtualizer Create(ItemsPresenter owner)
        {
            var             virtualizingPanel = owner.Panel as IVirtualizingPanel;
            var             scrollable        = (ILogicalScrollable)owner;
            ItemVirtualizer result            = null;

            if (virtualizingPanel != null && scrollable.InvalidateScroll != null)
            {
                switch (owner.VirtualizationMode)
                {
                case ItemVirtualizationMode.Simple:
                    result = new ItemVirtualizerSimple(owner);
                    break;
                }
            }

            if (result == null)
            {
                result = new ItemVirtualizerNone(owner);
            }

            if (virtualizingPanel != null)
            {
                virtualizingPanel.Controller = result;
            }

            return(result);
        }
Ejemplo n.º 2
0
        /// <inheritdoc/>
        protected override void PanelCreated(IPanel panel)
        {
            Virtualizer?.Dispose();
            Virtualizer = ItemVirtualizer.Create(this);
            ((ILogicalScrollable)this).InvalidateScroll?.Invoke();

            KeyboardNavigation.SetTabNavigation(
                (InputElement)Panel,
                KeyboardNavigation.GetTabNavigation(this));
        }
Ejemplo n.º 3
0
        /// <inheritdoc/>
        protected override void PanelCreated(IPanel panel)
        {
            _virtualizer = ItemVirtualizer.Create(this);
            ((ILogicalScrollable)this).InvalidateScroll?.Invoke();

            if (!Panel.IsSet(KeyboardNavigation.DirectionalNavigationProperty))
            {
                KeyboardNavigation.SetDirectionalNavigation(
                    (InputElement)Panel,
                    KeyboardNavigationMode.Contained);
            }

            KeyboardNavigation.SetTabNavigation(
                (InputElement)Panel,
                KeyboardNavigation.GetTabNavigation(this));
        }
Ejemplo n.º 4
0
        /// <inheritdoc/>
        protected override void PanelCreated(IPanel panel)
        {
            _virtualizer = ItemVirtualizer.Create(this);
            ((ILogicalScrollable)this).InvalidateScroll?.Invoke();

            if (!Panel.IsSet(KeyboardNavigation.DirectionalNavigationProperty))
            {
                KeyboardNavigation.SetDirectionalNavigation(
                    (InputElement)Panel,
                    KeyboardNavigationMode.Contained);
            }

            KeyboardNavigation.SetTabNavigation(
                (InputElement)Panel,
                KeyboardNavigation.GetTabNavigation(this));
        }
Ejemplo n.º 5
0
 private void VirtualizationModeChanged(AvaloniaPropertyChangedEventArgs e)
 {
     _virtualizer?.Dispose();
     _virtualizer = ItemVirtualizer.Create(this);
     ((ILogicalScrollable)this).InvalidateScroll?.Invoke();
 }
Ejemplo n.º 6
0
 private void VirtualizationModeChanged(AvaloniaPropertyChangedEventArgs e)
 {
     _virtualizer?.Dispose();
     _virtualizer = ItemVirtualizer.Create(this);
     ((ILogicalScrollable)this).InvalidateScroll?.Invoke();
 }