예제 #1
0
파일: Outline.cs 프로젝트: jimtonn/foldout
        /// <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));
        }
예제 #2
0
 protected override void OnRowRemoved(RowListEventArgs e)
 {
     base.OnRowRemoved(e);
     EventSequence.Execute(() => RowRemoved?.Invoke(this, new RowListEventArgs <TRow>((TRow)e.Row, e.Index)));
 }
예제 #3
0
 ///<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));
 }
예제 #4
0
 protected void OnRowRemoved(RowRemovedEventArgs e)
 => RowRemoved?.Invoke(this, e);