private void CreateListView() { int stato = 0; foreach (var item in ((ContactsViewModel)BindingContext).ListaTabItem) { StackLayout stackLayout = new StackLayout(); Label label = new Label { Text = "MAMA MO " + stato, TextColor = Color.Black, FontSize = 30, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.Center }; stackLayout.Children.Add(label); //ListView listView = new ListView //{ // HasUnevenRows = true, // RowHeight = -1, // ItemTemplate = new DataTemplate(typeof(AuditView)), // ItemsSource = ((ContactsViewModel)BindingContext).ContactList, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.Yellow, // VerticalOptions = LayoutOptions.FillAndExpand, // SeparatorVisibility = SeparatorVisibility.None, // SeparatorColor = Color.Transparent //}; //listView.ItemTapped += ListView_ItemTapped; //listView.Behaviors.Add(new EventToCommandBehavior //{ // Command = ((ContactsViewModel)BindingContext).OutputAgeCommand, // Converter = new SelectedItemEventArgsToSelectedItemConverter(), // EventName = "ItemTapped" //}); CustomTabItem customTabItem = new CustomTabItem { //Immagine = "https://picsum.photos/200/300", Title = item.ToUpper(), GridId = stato, BackgroundColor = Color.ForestGreen }; tabView.Items.Add(new SfTabItem() { Title = customTabItem.Title, Content = stackLayout, HeaderContent = customTabItem, SelectionColor = Color.White, }); stato++; } }
private void CreateListView() { int stato = 0; foreach (var item in ((ContactsViewModel)BindingContext).ListaTabItem) { ListView listView = new ListView { HasUnevenRows = true, RowHeight = -1, ItemTemplate = new DataTemplate(typeof(AuditView)), ItemsSource = ((ContactsViewModel)BindingContext).ContactList, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Yellow, VerticalOptions = LayoutOptions.FillAndExpand, SeparatorVisibility = SeparatorVisibility.None, SeparatorColor = Color.Transparent }; listView.ItemTapped += ListView_ItemTapped; listView.Behaviors.Add(new EventToCommandBehavior { Command = ((ContactsViewModel)BindingContext).OutputAgeCommand, Converter = new SelectedItemEventArgsToSelectedItemConverter(), EventName = "ItemTapped" }); CustomTabItem customTabItem = new CustomTabItem { //Immagine = "https://picsum.photos/200/300", Title = item.ToUpper(), GridId = stato }; tabView.Items.Add(new SfTabItem() { Title = customTabItem.Title, Content = listView, SelectionColor = Color.White }); stato++; } }