public GenMainTabbedView(GenMainPage parentPage) { _parentPage = parentPage; genSearchView = new GenSearchView(_parentPage); genMapView = new GenMapView(_parentPage); genUserListView = new GenUserListView(_parentPage); _tabList = new List <GenContentView> //needed for tab controls { genMapView, genSearchView, genUserListView }; // main tabbed view var tabViewControl = new TabViewControl(_tabList.Select(x => x.AsTabItem()).ToList()); tabViewControl.HeaderBackgroundColor = GlobalVars.ThemeColorsBG[(int)GlobalVars.ThemeColors.Secondary]; tabViewControl.HeaderTabTextColor = GlobalVars.ThemeColorsText[(int)GlobalVars.ThemeColors.Secondary]; this.Content = tabViewControl; this.VerticalOptions = LayoutOptions.FillAndExpand; this.HorizontalOptions = LayoutOptions.FillAndExpand; tabViewControl.PositionChanged += TabView_PositionChanged; tabViewControl.PositionChanging += TabView_PositionChanging; }
private void SetupTabView() { var tabView = new TabViewControl(new List <TabItem>() { new TabItem("ACCOUNTS", new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }), new TabItem("CARDS", new CardsLanding { VerticalOptions = LayoutOptions.StartAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }), new TabItem("WALLET", new Grid { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }) }); //tabView.HeaderTabTextFontFamily = Device.OnPlatform<string>("SF Pro Text", "Roboto-Regular.ttf#Roboto", ""); tabView.HeaderTabTextFontSize = tabView.HeaderTabTextFontSize + 1.5; tabView.HeaderBackgroundColor = (Color)App.Current.Resources["BackgroundColor"]; tabView.HeaderSelectionUnderlineColor = (Color)App.Current.Resources["PrimaryColor"]; tabView.HeaderTabTextColor = Color.Black; tabView.VerticalOptions = LayoutOptions.FillAndExpand; tabView.HorizontalOptions = LayoutOptions.FillAndExpand; Grid.SetRow(tabView, 1); MainView.Children.Add(tabView); }
public void CreateNewTab(int?InsertIndex, params string[] Path) { int Index = InsertIndex ?? (TabViewControl?.TabItems.Count ?? 0); try { if (CreateNewTabCore(Path) is TabViewItem Item) { TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } } catch (Exception ex) { if (CreateNewTabCore() is TabViewItem Item) { TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } LogTracer.Log(ex, "Error happened when try to create a new tab"); } }
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); }
public HomePage() { InitializeComponent(); ctlCarouselView.ItemsSource = new List <object> { new object { } }; _sampleView = new SampleView(); _tabView = new TabViewControl(new List <TabItem>() { new TabItem("DASHBOARD", _sampleView), }); gdTabView.Children.Add(_tabView); }
public XamlSamplePage() { InitializeComponent(); tabView1 = new TabViewControl(); tabView1.HorizontalOptions = LayoutOptions.FillAndExpand; tabView1.VerticalOptions = LayoutOptions.FillAndExpand; TabItem tabItem = new TabItem("One", new ColorsView()); TabItem tabItem2 = new TabItem("Two", new ColorsView()); tabView1.ItemSource.Add(tabItem); tabView1.ItemSource.Add(tabItem2); this.Content = tabView1; }
public async Task CreateNewTabAndOpenTargetFolder(string Path) { if (CreateNewTab(await StorageFolder.GetFolderFromPathAsync(Path)) is TabViewItem Item) { TabViewControl.TabItems.Add(Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; if (TabViewControl.TabItems.Count > 1) { foreach (TabViewItem Tab in TabViewControl.TabItems) { Tab.IsClosable = true; } } } }
public MainPage() { InitializeComponent(); string imageFilename = null; switch (Device.RuntimePlatform) { case Device.iOS: imageFilename = "Icon-Small-40.png"; break; case Device.Android: imageFilename = "icon.png"; break; case Device.UWP: imageFilename = "Assets/StoreLogo.png"; break; } tabView = new TabViewControl(new List <TabItem>() { new TabItem("Tab 1", new Label { Text = "Tab 1", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Red }, ImageSource.FromFile(imageFilename)), new TabItem("Tab 2", new Label { Text = "Tab 2", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Green }, ImageSource.FromFile(imageFilename)), new TabItem("Tab 3", new Label { Text = "Tab 3", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Blue }, ImageSource.FromFile(imageFilename)), }); tabView.VerticalOptions = LayoutOptions.FillAndExpand; theSl.Children.Add(tabView); tabView.PositionChanged += TabView_PositionChanged; tabView.PositionChanging += TabView_PositionChanging;; }
public MainPage() { InitializeComponent(); tabView = new TabViewControl(new List <TabItem>() { new TabItem("Tab 1", new Label { Text = "Tab 1", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Red }), new TabItem("Tab 2", new Label { Text = "Tab 2", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Green }), new TabItem("Tab 3", new Label { Text = "Tab 3", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Blue }), }); tabView.VerticalOptions = LayoutOptions.FillAndExpand; theSl.Children.Add(tabView); tabView.PositionChanged += TabView_PositionChanged; tabView.PositionChanging += TabView_PositionChanging;; }
public void CreateNewTabAndOpenTargetFolder(string Path, int?InsertIndex = null) { int Index = InsertIndex ?? (TabViewControl?.TabItems.Count ?? 0); try { if (string.IsNullOrWhiteSpace(Path)) { if (CreateNewTab() is TabViewItem Item) { TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } } else { if (CreateNewTab(Path) is TabViewItem Item) { TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } } } catch (Exception ex) { if (CreateNewTab() is TabViewItem Item) { TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } LogTracer.Log(ex, "Error happened when try to create a new tab"); } }
public async Task CreateNewTabAndOpenTargetFolder(string Path, int?InsertIndex = null) { int Index = InsertIndex ?? (TabViewControl?.TabItems.Count ?? 0); try { if (string.IsNullOrWhiteSpace(Path)) { if (CreateNewTab() is TabViewItem Item) { //预览版TabView在没有子Item时会崩溃,此方案作为临时解决方案 if (TabViewControl == null) { _ = FindName(nameof(TabViewControl)); } TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } } else { if (WIN_Native_API.CheckIfHidden(Path)) { QueueContentDialog Dialog = new QueueContentDialog { Title = Globalization.GetString("Common_Dialog_ErrorTitle"), Content = Globalization.GetString("QueueDialog_ItemHidden_Content"), CloseButtonText = Globalization.GetString("Common_Dialog_CloseButton") }; _ = await Dialog.ShowAsync().ConfigureAwait(true); //预览版TabView在没有子Item时会崩溃,此方案作为临时解决方案 if (TabViewControl == null) { _ = FindName(nameof(TabViewControl)); if (CreateNewTab() is TabViewItem EmptyItem) { TabViewControl.TabItems.Insert(Index, EmptyItem); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = EmptyItem; } } } else { StorageFolder TargetFolder = await StorageFolder.GetFolderFromPathAsync(Path); if (CreateNewTab(TargetFolder) is TabViewItem Item) { //预览版TabView在没有子Item时会崩溃,此方案作为临时解决方案 if (TabViewControl == null) { _ = FindName(nameof(TabViewControl)); } TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } } } } catch (Exception ex) { if (CreateNewTab() is TabViewItem Item) { //预览版TabView在没有子Item时会崩溃,此方案作为临时解决方案 if (TabViewControl == null) { _ = FindName(nameof(TabViewControl)); } TabViewControl.TabItems.Insert(Index, Item); TabViewControl.UpdateLayout(); TabViewControl.SelectedItem = Item; } LogTracer.Log(ex, "Error happened when try to create a new tab"); } }