Example #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <TabbedPageBottom> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement != null)
            {
                TabbedPageBottom bottomBarPage = e.NewElement;

                if (_bottomBar == null)
                {
                    _pageController = PageController.Create(bottomBarPage);

                    // create a view which will act as container for Page's
                    _frameLayout = new FrameLayout(Context);
                    _frameLayout.LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent, GravityFlags.Fill);
                    AddView(_frameLayout, 0);

                    // create bottomBar control
                    _bottomBar = BottomBar.Attach(_frameLayout, null);
                    _bottomBar.NoTabletGoodness();

                    _bottomBar.UseFixedMode();

                    _bottomBar.LayoutParameters = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent);
                    _bottomBar.SetOnTabClickListener(this);

                    // create tab items
                    SetTabItems();
                }

                if (bottomBarPage.CurrentPage != null)
                {
                    SwitchContent(bottomBarPage.CurrentPage);
                    UpdateSelectedTabIndex(Element.CurrentPage);
                }
            }
        }