protected async Task OnDeleteCommand(TItem item) { if (Data is ICollection <TItem> data) { if (await IsSafeToProceed(RowRemoving, item)) { if (UseInternalEditing) { if (data.Contains(item)) { data.Remove(item); } } await RowRemoved.InvokeAsync(item); dirtyFilter = dirtyView = true; } } // When deleting and the page becomes empty and we aren't the first page: // go to the previous page if (ManualReadMode && ShowPager && CurrentPage > paginationContext.FirstVisiblePage && !Data.Any()) { await OnPaginationItemClick((CurrentPage - 1).ToString()); } }
/// <summary> /// Removes the specified row from the outline. A row must have 0 children before /// it can be removed. Callers are responsible for reparenting or removing any /// children prior to a move. /// </summary> public void RemoveRow(Row row) { if (row == RootRow) { throw new InvalidOperationException("Root row cannot be removed."); } if (row.Children.Any()) { throw new InvalidOperationException("Row cannot be removed because it has children."); } if (!row.ParentRow.Children.Contains(row)) { throw new InvalidOperationException("Row not found. It may have already been removed."); } row.ParentRow._children.Remove(row); RowRemoved?.Invoke(this, new RowRemovedEventArgs(row)); }
protected async Task OnDeleteCommand(TItem item) { if (Data is ICollection <TItem> data) { if (IsSafeToProceed(RowRemoving, item)) { if (UseInternalEditing) { if (data.Contains(item)) { data.Remove(item); } } } await RowRemoved.InvokeAsync(item); dirtyFilter = dirtyView = true; } }
///<summary>Raises the RowRemoved event.</summary> ///<param name="e">A RowEventArgs object that provides the event data.</param> protected virtual void OnRowRemoved(RowListEventArgs e) { EventSequence.Execute(() => RowRemoved?.Invoke(this, e)); }
protected override void OnRowRemoved(RowListEventArgs e) { base.OnRowRemoved(e); EventSequence.Execute(() => RowRemoved?.Invoke(this, new RowListEventArgs <TRow>((TRow)e.Row, e.Index))); }
protected void OnRowRemoved(RowRemovedEventArgs e) => RowRemoved?.Invoke(this, e);