public MainPageViewModel() { var src = new emp[] { new emp { name = "test", age = 38, id = "sam" + 1 } }.ToList(); for (int i = 2; i < 100; i++) { src.Add(new emp { name = "test " + i, age = i + 20, id = "sam" + i }); } Itemsource = src; GridColumns = new List <XFGridColumn>(); GridColumns.Add(new XFGridColumn { DisplayName = "ID", PropertyName = "id" }); GridColumns.Add(new XFGridColumn { DisplayName = "Name", PropertyName = "name" }); GridColumns.Add(new XFGridColumn { DisplayName = "Age", PropertyName = "age" }); }
private void XFDataGridControl_OnNeedDataSource(object sender, XFNeedDataSourceEventArgs args) { var src = new emp[] { new emp { name = "datasource", age = 38, id = "sam" + 1 } }.ToList(); for (int i = 2; i < 12; i++) { src.Add(new emp { name = "datasource " + i, age = i + 20, id = "sam" + i }); } args.ItemSource = src; }
private void Grid_OnPullToRefresh(object sender, XFPullToRefreshEventArgs args) { IList tt = new emp[] { new emp { name = "test", age = 89, id = "test" + 89 }, }.ToList(); for (int k = 0; k < 3; k++) { tt.Add(new emp { name = "newitem" + k, age = 20 + k + 10, id = "upee" + k }); } args.NewItems = tt; }
public MainPage() { InitializeComponent(); var source = new emp[] { new emp { Name = "Smith", Age = 89 }, new emp { Name = "John", Age = 11 } }.ToList(); for (int k = 0; k < 43; k++) { var test = new[] { new emp { Name = "Smith", Age = 20 + k + 10 }, new emp { Name = "John", Age = 200 + k + 10 } }.ToList(); source.AddRange(test.ToList()); } var grid = new XFDataGridControl { ItemsSource = source, VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand }; // grid.refres(); grid.OnItemEdit += Grid_OnItemEdit; stack.Children.Add(grid); }