예제 #1
0
            bool NavigationBarView.IOnItemSelectedListener.OnNavigationItemSelected(IMenuItem item)
            {
                if (_tabbedPageManager.Element == null)
                {
                    return(false);
                }

                var id = item.ItemId;

                if (id == BottomNavigationViewUtils.MoreTabId)
                {
                    var items             = _tabbedPageManager.CreateTabList();
                    var bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(_tabbedPageManager.OnMoreItemSelected, _tabbedPageManager.Element.FindMauiContext(), items, _tabbedPageManager._bottomNavigationView.MaxItemCount);
                    bottomSheetDialog.DismissEvent += _tabbedPageManager.OnMoreSheetDismissed;
                    bottomSheetDialog.Show();
                }
                else
                {
                    if (_tabbedPageManager._bottomNavigationView.SelectedItemId != item.ItemId && _tabbedPageManager.Element.Children.Count > item.ItemId)
                    {
                        _tabbedPageManager.Element.CurrentPage = _tabbedPageManager.Element.Children[item.ItemId];
                    }
                }

                return(true);
            }
예제 #2
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            if (Element == null || IsDisposed)
            {
                return(false);
            }

            var id = item.ItemId;

            if (id == BottomNavigationViewUtils.MoreTabId)
            {
                var items             = CreateTabList();
                var bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(OnMoreItemSelected, Element.FindMauiContext(), items, _bottomNavigationView.MaxItemCount);
                bottomSheetDialog.DismissEvent += OnMoreSheetDismissed;
                bottomSheetDialog.Show();
            }
            else
            {
                if (_bottomNavigationView.SelectedItemId != item.ItemId && Element.Children.Count > item.ItemId)
                {
                    Element.CurrentPage = Element.Children[item.ItemId];
                }
            }
            return(true);
        }
예제 #3
0
        protected virtual bool OnItemSelected(IMenuItem item)
        {
            var id = item.ItemId;

            if (id == MoreTabId)
            {
                var items = CreateTabList(ShellItem);
                _bottomSheetDialog = BottomNavigationViewUtils.CreateMoreBottomSheet(OnMoreItemSelected, MauiContext, items, _bottomView.MaxItemCount);
                _bottomSheetDialog.Show();
                _bottomSheetDialog.DismissEvent += OnMoreSheetDismissed;
            }
            else
            {
                var shellSection = ((IShellItemController)ShellItem).GetItems()[id];
                if (item.IsChecked)
                {
                    OnTabReselected(shellSection);
                }
                else
                {
                    return(ChangeSection(shellSection));
                }
            }

            return(true);
        }