private void CreateTabView()
        {
            SfTabView tabView  = new SfTabView();
            var       TabItems = new TabItemCollection();

            TabItems.Add(new SfTabItem()
            {
                Title = "Tab 1", Content = new Datagrid()
            });
            TabItems.Add(new SfTabItem()
            {
                Title = "Tab 2", Content = new TreeView()
            });
            TabItems.Add(new SfTabItem()
            {
                Title = "Tab 3", Content = new TabContent()
            });
            TabItems.Add(new SfTabItem()
            {
                Title = "Tab 4", Content = new StackLayout {
                    BackgroundColor = Color.LightGreen
                }
            });
            TabItems.Add(new SfTabItem()
            {
                Title = "Tab 5", Content = new StackLayout {
                    BackgroundColor = Color.LightSkyBlue
                }
            });
            tabView.Items = TabItems;
            stack.Children.Add(tabView);
        }
        void InitializeTabView()
        {
            TabItemCollection collection = new TabItemCollection();

            tabView = new SfTabView();
            tabView.TabHeaderBackgroundColor = UIColor.Clear;
            tabView.BackgroundColor          = UIColor.FromRGB(48, 146, 246); //UIColor.White;//UIColor.FromRGB(48, 146, 246);
            tabView.TabHeaderBackgroundColor = UIColor.FromRGB(48, 146, 246); //UIColor.White;//UIColor.FromRGB(48, 146, 246);
            tabView.Frame = new CGRect(0, 0, this.Frame.Width, this.Frame.Height);

            SfTabItem furnitureTab = new SfTabItem();

            furnitureTab.Title             = "Furniture";
            furnitureTab.IconFont          = "A";
            furnitureTab.Content           = InitializeTabContent("Furniture", 5);
            furnitureTab.TitleFontColor    = UIColor.White;
            furnitureTab.FontIconFontColor = UIColor.White;
            furnitureTab.SelectionColor    = UIColor.White;
            furnitureTab.FontIconFont      = UIFont.FromName("TabIcons", 20);
            collection.Add(furnitureTab);

            SfTabItem clothingTab = new SfTabItem();

            clothingTab.IconFont          = "C";
            clothingTab.Title             = "Clothing";
            clothingTab.Content           = InitializeTabContent("Clothing", 5);
            clothingTab.TitleFontColor    = UIColor.White;
            clothingTab.FontIconFontColor = UIColor.White;
            clothingTab.SelectionColor    = UIColor.White;
            clothingTab.FontIconFont      = UIFont.FromName("TabIcons", 20);
            collection.Add(clothingTab);

            SfTabItem shoesTab = new SfTabItem();

            shoesTab.IconFont          = "F";
            shoesTab.Title             = "Shoes";
            shoesTab.Content           = InitializeTabContent("Shoes", 5);
            shoesTab.TitleFontColor    = UIColor.White;
            shoesTab.FontIconFontColor = UIColor.White;
            shoesTab.SelectionColor    = UIColor.White;
            shoesTab.FontIconFont      = UIFont.FromName("TabIcons", 20);
            collection.Add(shoesTab);

            SfTabItem fruitsTab = new SfTabItem();

            fruitsTab.IconFont          = "H";
            fruitsTab.Title             = "Fruits";
            fruitsTab.Content           = InitializeTabContent("Fruits", 5);
            fruitsTab.TitleFontColor    = UIColor.White;
            fruitsTab.FontIconFontColor = UIColor.White;
            fruitsTab.SelectionColor    = UIColor.White;
            fruitsTab.FontIconFont      = UIFont.FromName("TabIcons", 20);
            collection.Add(fruitsTab);

            SfTabItem toysTab = new SfTabItem();

            toysTab.Title             = "Toys";
            toysTab.IconFont          = "K";
            toysTab.Content           = InitializeTabContent("Toys", 5);
            toysTab.TitleFontColor    = UIColor.White;
            toysTab.FontIconFontColor = UIColor.White;
            toysTab.SelectionColor    = UIColor.White;
            toysTab.FontIconFont      = UIFont.FromName("TabIcons", 20);
            collection.Add(toysTab);

            tabView.Items = collection;
            Add(tabView);

            tabView.SelectionIndicatorSettings.Color = UIColor.White;
            tabView.TabHeight = 60;

            if ((UIDevice.CurrentDevice).UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                tabView.TabWidth = 150;
            }
        }
Esempio n. 3
0