Beispiel #1
0
        void SetupBottomNavigationView(NotifyCollectionChangedEventArgs e)
        {
            var currentIndex = Element.Children.IndexOf(Element.CurrentPage);
            var items        = CreateTabList();

            BottomNavigationViewUtils.SetupMenu(
                _bottomNavigationView.Menu,
                _bottomNavigationView.MaxItemCount,
                items,
                currentIndex,
                _bottomNavigationView,
                Element.FindMauiContext());

            if (Element.CurrentPage == null && Element.Children.Count > 0)
            {
                Element.CurrentPage = Element.Children[0];
            }
        }
Beispiel #2
0
        protected virtual void SetupMenu(IMenu menu, int maxBottomItems, ShellItem shellItem)
        {
            if (DisplayedPage == null)
            {
                return;
            }

            if (ShellItemController.ShowTabs)
            {
                _menuSetup = true;
                var currentIndex = ((IShellItemController)ShellItem).GetItems().IndexOf(ShellSection);
                var items        = CreateTabList(shellItem);

                BottomNavigationViewUtils.SetupMenu(
                    menu,
                    maxBottomItems,
                    items,
                    currentIndex,
                    _bottomView,
                    MauiContext);
            }

            UpdateTabBarVisibility();
        }