// Take the result of the parent and generate the result for the next operation internal INTERNAL_CollectionViewGroupInternal(ICollection <object> source, INTERNAL_CollectionViewGroupInternal parent, INTERNAL_Operations operations, int level = 0) { Items = source; _level = level; _parentView = parent; _operations = operations; object operationToDo = _operations.HandleNextOperation(_level); ExecuteOperation(operationToDo); }
// create all the operation tree with a new source void CreateTree() { _views.Clear(); _operations = new INTERNAL_Operations(this); // we reset the operations to do ICollection <object> newCollection = new Collection <object>(); foreach (object obj in _originalDataSource) { newCollection.Add(obj); } CollectionViewGroupInternal treeRoot = new CollectionViewGroupInternal(newCollection.ToList <object>(), null, _operations); _views.Add(treeRoot); // we make sure that the treeRoot is the last element to be added to the _views collection because the call to the CollectionViewGroupInternal contructor creates a tree via recursion, which by itself adds the branches in _views. ConstrainIndexToRemainInsideAllowedRange(); // because some leaves can disappear if it's not the first generation (ie. if it has already been refreshed once) }