Advertisement
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 ListViewDemoVS
- {
- class MyContentPage : ContentPage
- {
- public MyContentPage()
- {
- List<String> items = new List<String>()
- {
- "First", "Second", "Third"
- };
- Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
- ListView listView = new ListView();
- listView.ItemsSource = items;
- /*
- listView.ItemTapped += async (sender, e) =>
- {
- await DisplayAlert("Tapped", e.Item.ToString(), "OK");
- ((ListView)sender).SelectedItem = null;
- };
- */
- listView.ItemSelected += async (sender, e) =>
- {
- if (e.SelectedItem == null) return;
- await DisplayAlert("Selected", e.SelectedItem.ToString(), "OK");
- ((ListView)sender).SelectedItem = null;
- };
- this.Content = listView;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement