public NativeListViewPage2() { var nativeListView2 = new NativeListView2(); // CUSTOM RENDERER using a native control nativeListView2.VerticalOptions = LayoutOptions.FillAndExpand; // REQUIRED: To share a scrollable view with other views in a StackLayout, it should have a VerticalOptions of FillAndExpand. nativeListView2.Items = DataSource2.GetList(); nativeListView2.ItemSelected += async(sender, e) => { //await Navigation.PushModalAsync (new DetailPage(e.SelectedItem)); await DisplayAlert("clicked", "one of the rows was clicked", "ok"); }; // The root page of your application Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0), Children = { new Label { HorizontalTextAlignment = TextAlignment.Center, Text = Device.OnPlatform("Custom UITableView+UICell", "Custom ListView+Cell", "Custom renderer ListView+DataTemplate") }, nativeListView2 } }; }
public NativeListViewPage2 () { var nativeListView2 = new NativeListView2 (); // CUSTOM RENDERER using a native control nativeListView2.VerticalOptions = LayoutOptions.FillAndExpand; // REQUIRED: To share a scrollable view with other views in a StackLayout, it should have a VerticalOptions of FillAndExpand. nativeListView2.Items = DataSource2.GetList (); nativeListView2.ItemSelected += async (sender, e) => { //await Navigation.PushModalAsync (new DetailPage(e.SelectedItem)); await DisplayAlert ("clicked", "one of the rows was clicked", "ok"); }; // The root page of your application Content = new StackLayout { Padding = new Thickness (0, Device.OnPlatform (20, 0, 0), 0, 0), Children = { new Label { HorizontalTextAlignment = TextAlignment.Center, Text = Device.OnPlatform ("Custom UITableView+UICell", "Custom ListView+Cell", "Custom renderer ListView+DataTemplate") }, nativeListView2 } }; }