Here is my sample xaml
<ListView ItemsSource="{Binding EmployeeList}" HasUnevenRows="True"
IsPullToRefreshEnabled="True" RefreshCommand="{Binding RefreshCommand}" IsRefreshing="{Binding IsBusy}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding Name}" TextColor="Black"/>
<Label Text="{Binding Department}" TextColor="Black"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
<Image Source="{Binding GetSource}"/>
i want that when a user pull down on list view then it will load a image from URI(just playing around)
here is my view model
public class MainViewModel : INotifyPropertyChanged
{
private List<Employee> _employeeList { get; set; }
private string _source { get; set; }
public string GetSource { get { return _source; } set { _source = value; OnPropertyChanged(); } }
Command _refreshCommand;
public Command RefreshCommand
{
get
{
return _refreshCommand;
}
}
public List<Employee> EmployeeList
{
get { return _employeeList; }
set { _employeeList = value;
OnPropertyChanged();
}
}
// class constractor
public MainViewModel()
{
var employeeServices = new EmployeeServices();
EmployeeList = employeeServices.GetEmployees();
_refreshCommand = new Command(ShowImage);
}
private void ShowImage()
{
var imagesou = "https://www.hindustantimes.com/rf/image_size_640x362/HT/p2/2016/04/08/Pictures/_e76dfb4e-fd62-11e5-bced-6695953481e2.jpg";
GetSource = imagesou;
}
#region PropertyChange
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName=null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
Problem is that when I pull down for refreshing,then it works fine,but after complete image loading the refresh indicator is not stopping,so how to do this?