代码之家  ›  专栏  ›  技术社区  ›  Barney Chambers

添加Xamarin窗体BottomBarPage onClick()侦听器

  •  1
  • Barney Chambers  · 技术社区  · 6 年前

    { var tab2=新接收页面(空); var tab5=新信息页(空); BottomBar.Children.Add(表3); BottomBar.Children.Add(表5);

    如何将侦听器添加到此 BottomBarpage which checks which of the tabs is currently selected,so that I can add the code below to this listener.

    { } enter image description here

            BottomBarPage bottomBar = new BottomBarPage
            {
    
            };
    
            var tab1 = new MainPage();
            var tab2 = new ReceivePage(null);
            var tab3 = new SendPage(false);
            var tab4 = new SendPage(false);
            var tab5 = new InfoPage(null);
    
            bottomBar.Children.Add(tab1);
            bottomBar.Children.Add(tab2);
            bottomBar.Children.Add(tab3);
            bottomBar.Children.Add(tab4);
            bottomBar.Children.Add(tab5);
    

    如何向此添加侦听器 BottomBarPage

            if (bottomBar.SelectedItem == bottomBar.Children[3])
            {
                //do something
            }
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   uprightbassfan78    6 年前

     tabLayout.TabSelected += OnTabSelected