Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ItemsControl"/> class.
        /// </summary>
        /// <param name="uv">The Ultraviolet context.</param>
        /// <param name="name">The element's identifying name within its namescope.</param>
        public ItemsControl(UltravioletContext uv, String name)
            : base(uv, name)
        {
            this.itemContainerGenerator = new ItemContainerGenerator(this);

            this.items = new ItemCollection(this);
            this.items.CollectionReset += ItemsCollectionReset;
            this.items.CollectionItemAdded += ItemsCollectionItemAdded;
            this.items.CollectionItemRemoved += ItemsCollectionItemRemoved;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the next enabled and visible tab after the specified tab.
        /// </summary>
        private TabItem GetNextEnabledTabItem(Int32 start, Int32 delta)
        {
            if (delta == 0)
            {
                return(null);
            }

            var count   = Items.Count;
            var current = (count + ((start + delta) % count)) % count;

            for (int i = 0; i < Items.Count; i++)
            {
                var container = ItemContainerGenerator.ContainerFromIndex(current) as TabItem;
                if (container != null && container.IsEnabled && container.Visibility == Visibility.Visible)
                {
                    return(container);
                }

                current = (count + ((start + delta) % count)) % count;
            }

            return(null);
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        protected internal override UIElement GetLogicalChild(Int32 childIndex)
        {
            var container = itemContainers[childIndex];

            return((UIElement)ItemContainerGenerator.ItemFromContainer(container));
        }