-
Notifications
You must be signed in to change notification settings - Fork 0
ObservableTable Public Methods
Initialize a new ObservableTable with no column headers and no records (rows).
public ObservableTable<T>()
Initialize a new ObservableTable with the given column headers and records.
public ObservableTable(IEnumerable<T> headers, IEnumerable<IList<T?>> records)
public ObservableTable(IEnumerable<T> headers, params IList<T?>[] records)
While technically not a method, ObservableTable offers the following event:
public event EventHandler? TableModified
It is triggered after any of the following methods are invoked. Event arguments are not implemented currently.
Rows can be accessed by ObservableTable.Records[index]
. Only modify rows with the following methods.
Insert rows
after position index
.
public void InsertRow(int index, IEnumerable<IList<T?>> rows)
public void InsertRow(int index, params IList<T?>[] rows)
public void RemoveRow(IEnumerable<ObservableCollection<T?>> rows)
public void RemoveRow(params ObservableCollection<T?>[] rows)
Move row oldIndex
to newIndex
public void ReorderRow(int oldIndex, int newIndex)
Columns cannot be accessed directly. Only modify columns with the following methods.
Insert columns
after index
public void InsertColumn(int index, params Column<T>[] columns)
public void InsertColumn(int index, IEnumerable<Column<T>> columns)
public void RemoveColumn(IEnumerable<T> headers)
public void RemoveColumn(params T[] headers)
Move column oldIndex
to newIndex
public void ReorderColumn(int oldIndex, int newIndex)
Rename column index
to header
public void RenameColumn(int index, T header)
Cells can be accessed directly by ObservableTable.Records[row][column]
.
public void SetCell(IEnumerable<Cell<T>> cells)
public void SetCell(params Cell<T>[] cells)
It is also possible to change the cell content by
ObservableTable.Records[row][column] = <new content>;
However, it is recommended that the SetCell
methods be prioritized. Use the assignment statement for external code that you do not maintain exclusively (e.g. a DataGrid).
public void Undo()
public void Redo()
Undo/redo the previous transaction. Rows and columns added through the constructor cannot be undone/redone. If the initial records must be undo-able, obtain a new instance of ObservableTable using the empty constructor, then manually invoke the InsertColumns
and InsertRows
methods.
ObservableTable exposes two properties, undoCount
and redoCount
, that shows how many operations can be undone/redone.