Пример #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);
        }
Пример #2
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;
        }