Dear community,
I'm testing my code on Android and didn't expect following result:
This is my piece of code that creates SfTabViewItems dynamically:
private void SeedNewTab(Berechnung berechnung = null)
{ var tab = new SfTabItem(); var content = new ErfassungDarlehen(berechnung); var context = (DarlehensrechnerViewModel)content.BindingContext; tab.Title = context.Berechnung.Name; var headerContent = new StackLayout() { Orientation = StackOrientation.Horizontal };var title_label = new Label { FontSize = Device.GetNamedSize(NamedSize.Caption, typeof(Label)), Text = tab.Title, TextColor = (Color)MarkupExtensions.GetResourceValue("PrimaryColor"), HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center };
headerContent.Children.Add(title_label);var close_label = new Label { FontFamily =(OnPlatform)MarkupExtensions.GetResourceValue("FontAwesomeLight"), FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), Text = Extensions.Icon.Close_Circle, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center };
close_label.GestureRecognizers.Add(new TapGestureRecognizer { Command = this.CloseCommand }); headerContent.Children.Add(close_label); tab.HeaderContent = headerContent; var scrollView = new ScrollView(); scrollView.Content = new ContentView() { Content = content }; tab.Content = scrollView;
//Position bestimmen if (BerechnungenTabView.Items.Contains(Mediator.CurrentTab)) { BerechnungenTabView.Items.Insert(BerechnungenTabView.Items.IndexOf(Mediator.CurrentTab), tab); } else { BerechnungenTabView.Items.Add(tab); Mediator.CurrentTab = BerechnungenTabView.Items[0]; } }
This View is from UWP:
And on Android it's:
Ah and here's my SfTabView Control:
<tabview:SfTabView x:Name="BerechnungenTabView"
EnableSwiping="False" HeightRequest="1080" OverflowMode="Scroll" SelectionChanged="TabViewSelectionChanged" TabWidthMode="BasedOnText">Hello Jeya,
thank you very much for that quick solution. Everything is working fine by now I appreciate your service.
Good bye