public partial class SfDataGridPage : ContentPage
{
private OrderInfoRepository repository;
private ObservableCollection<OrderInfo> source;
public SfDataGridPage()
{
InitializeComponent();
repository = new OrderInfoRepository();
source = repository.GetOrderDetails(200);
this.dataPager.OnDemandLoading += DataPager_OnDemandLoading;
this.dataGrid.SetBinding(SfDataGrid.ItemsSourceProperty, new Binding() { Path = "PagedSource", Source = this.dataPager });
}
private void DataPager_OnDemandLoading(object sender, OnDemandLoadingEventArgs args)
{
dataPager.LoadDynamicItems(args.StartIndex, viewModel.OrdersInfo.Skip(args.StartIndex).Take(args.PageSize));
}
} |