private void OnItemsSourceChanged() { addRemoveItemHanlder.Reset(); //_manualSort.Clear(); ScrollPosition = new Point(ScrollPosition.X, 0); if (_view != null) { _view.VectorChanged -= _view_VectorChanged; } _view = ItemsSource as ICollectionView; _props = null; _itemType = null; if (_view == null && ItemsSource != null) { _view = new UWPCollectionView(ItemsSource); } // remove old rows, auto-generated columns Rows.Clear(); // bind grid to new data source if (_view != null) { // connect event handlers _view.VectorChanged += _view_VectorChanged; // get list of properties available for binding _props = GetItemProperties(); //HanldeOuterScrollViewerWithISupportIncrementalLoading(); // just in case GetItemProperties changed something // initialize non-auto-generated column bindings foreach (var col in Columns) { //if (!col.AutoGenerated) { BindColumn(col); } } // load rows LoadRows(); } }
void LoadRows() { if (_view != null) { //if (LoadingRows != null) //{ // LoadingRows(this, EventArgs.Empty); //} using (Rows.DeferNotifications()) { // add all data items Rows.Clear(); CreateBoundRows(); } //if (LoadedRows != null) //{ // LoadedRows(this, EventArgs.Empty); //} // show new data and sorting order Invalidate(); } }