예제 #1
0
        private async void CreateTabView()
        {
            await comicViewModel.GetComicsEvents(superHero);

            listViewComics.ItemsSource  = comicViewModel.ListComic;
            listViewEvents.ItemsSource  = comicViewModel.ListEvent;
            listViewComics.RowHeight    = 100;
            listViewEvents.RowHeight    = 100;
            listViewComics.Footer       = "";
            listViewEvents.Footer       = "";
            listViewComics.ItemTemplate = new DataTemplate(typeof(CustomCell));
            listViewEvents.ItemTemplate = new DataTemplate(typeof(CustomCell));

            var labelTabComic = "(" + superHero.ComicsAvailable + ")" + " " + "Comics";
            var labelTabEvent = "(" + superHero.EventsAvailable + ")" + " " + "Eventos";

            tabView = new TabViewControl(new List <TabItem>()
            {
            });

            if (superHero.EventsAvailable != 0)
            {
                tabView.AddTab(new TabItem(labelTabEvent, listViewEvents));
            }
            else
            {
                tabView.AddTab(new TabItem(labelTabEvent, new Label {
                    Text = "No se han encontrado resultados.", HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.SlateGray
                }));
            }

            if (superHero.ComicsAvailable != 0)
            {
                tabView.AddTab(new TabItem(labelTabComic, listViewComics));
            }
            else
            {
                tabView.AddTab(new TabItem(labelTabComic, new Label {
                    Text = "No se han encontrado resultados.", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), TextColor = Color.SlateGray
                }));
            }

            tabView.HeaderBackgroundColor             = Color.DarkRed;
            tabView.HeaderSelectionUnderlineColor     = Color.YellowGreen;
            tabView.HeaderSelectionUnderlineWidth     = 200;
            tabView.HeaderSelectionUnderlineThickness = 0.5;
            tabView.HeaderTabTextFontSize             = Device.GetNamedSize(NamedSize.Medium, typeof(Label));
            tabView.HeaderTabTextColor          = Color.WhiteSmoke;
            tabView.HeaderTabTextFontAttributes = FontAttributes.Bold;
            tabView.HorizontalOptions           = LayoutOptions.FillAndExpand;
            tabView.VerticalOptions             = LayoutOptions.FillAndExpand;
            layoutTabView.Children.Add(tabView);
        }
예제 #2
0
 private void Button_AddTab(object sender, EventArgs e)
 {
     tabView.AddTab(new TabItem("New", new Label {
         Text = "New", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Red
     }));
 }