Beispiel #1
0
        public BreadcrumbControl()
        {
            Height = 26;
            TabContainer.Spacing  = new Vector2(padding, 0f);
            Current.ValueChanged += tab =>
            {
                foreach (var t in TabContainer.Children.OfType <BreadcrumbTabItem>())
                {
                    var tIndex   = TabContainer.IndexOf(t);
                    var tabIndex = TabContainer.IndexOf(TabMap[tab]);

                    t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible;
                    t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint);
                }
            };
        }
Beispiel #2
0
        private void tabCloseRequested(TabItem <Channel> tab)
        {
            int totalTabs    = TabContainer.Count - 1; // account for selectorTab
            int currentIndex = MathHelper.Clamp(TabContainer.IndexOf(tab), 1, totalTabs);

            if (tab == SelectedTab && totalTabs > 1)
            {
                // Select the tab after tab-to-be-removed's index, or the tab before if current == last
                SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]);
            }
            else if (totalTabs == 1 && !selectorTab.Active.Value)
            {
                // Open channel selection overlay if all channel tabs will be closed after removing this tab
                SelectTab(selectorTab);
            }

            OnRequestLeave?.Invoke(tab.Value);
        }
        public BreadcrumbControl()
        {
            Height = 32;
            TabContainer.Spacing = new Vector2(padding, 0f);
            SwitchTabOnRemove    = false;

            Current.ValueChanged += index =>
            {
                foreach (var t in TabContainer.Children.OfType <BreadcrumbTabItem>())
                {
                    var tIndex   = TabContainer.IndexOf(t);
                    var tabIndex = TabContainer.IndexOf(TabMap[index.NewValue]);

                    t.State = tIndex > tabIndex ? Visibility.Hidden : Visibility.Visible;
                    t.Chevron.FadeTo(tIndex >= tabIndex ? 0f : 1f, 500, Easing.OutQuint);
                }
            };
        }