Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Forms;
- namespace DrilldownListViewDemoVS
- {
- class DrilldownListViewByItem : ContentPage
- {
- public DrilldownListViewByItem()
- {
- Title = "Drilldown List Using ListView";
- ListView listView = new ListView();
- listView.ItemsSource = new ListItem[] {
- new ListItem { Title = "First", Description = "1st item" },
- new ListItem { Title = "Second", Description = "2nd item" },
- new ListItem { Title = "Third", Description = "3rd item" }
- };
- listView.ItemTemplate = new DataTemplate(typeof(TextCell));
- listView.ItemTemplate.SetBinding(TextCell.TextProperty, "Title");
- listView.ItemTapped += async (sender, e) =>
- {
- var item = e.Item as ListItem;
- if (item == null) return;
- await Navigation.PushAsync(new DetailPage(item));
- listView.SelectedItem = null;
- };
- this.Content = listView;
- }
- }
- }
Add Comment
Please, Sign In to add comment