XF 列表视图事件
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App30"
x:Class="App30.MainPage">
<StackLayout>
<ListView x:Name="myListView" ItemSelected="myListView_ItemSelected" ItemTapped="myListView_ItemTapped"
Refreshing="myListView_Refreshing"></ListView>
<Button Text="Refresh" Clicked="Button_Clicked"></Button>
</StackLayout>
</ContentPage>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App30
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
myListView.ItemsSource = new string[]
{
"zhangsan","lisi","wangwu","zhaoliu"
};
myListView.IsPullToRefreshEnabled = true;
}
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
myListView.ItemsSource = new string[]
{
"zhangsan","lisi","wangwu","zhaoliu"
};
myListView.IsPullToRefreshEnabled = true;
}
private void myListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
{
//DisplayAlert("你选择了", e.SelectedItem.ToString(), "Ok");
}
{
//DisplayAlert("你选择了", e.SelectedItem.ToString(), "Ok");
}
private void myListView_ItemTapped(object sender, ItemTappedEventArgs e)
{
DisplayAlert("你选择了", e.Item.ToString(), "Ok");
}
{
DisplayAlert("你选择了", e.Item.ToString(), "Ok");
}
private void myListView_Refreshing(object sender, EventArgs e)
{
myListView.ItemsSource = new string[]
{
"abc","123","hij","888"
};
myListView.EndRefresh();
}
{
myListView.ItemsSource = new string[]
{
"abc","123","hij","888"
};
myListView.EndRefresh();
}
private void Button_Clicked(object sender, EventArgs e)
{
myListView.BeginRefresh();
}
}
}
{
myListView.BeginRefresh();
}
}
}