Class TableView
View for tabular data based on a ITableSource. See TableView Deep Dive for more information.
public class TableView : View, IDisposable, ISupportInitializeNotification, ISupportInitialize, IDesignable
- Inheritance
-
TableView
- Implements
- Inherited Members
Constructors
- TableView()
Initializes a TableView class. Set the Table property to begin editing
- TableView(ITableSource)
Initializes a TableView class.
Fields
- DefaultMaxCellWidth
The default maximum cell width for MaxCellWidth and MaxWidth
- DefaultMinAcceptableWidth
The default minimum cell width for MinAcceptableWidth
Properties
- CellActivationKey
The key which when pressed should trigger CellActivated event. Defaults to Enter.
- CollectionNavigator
Navigator for cycling the selected item in the table by typing. Set to null to disable this feature.
- ColumnOffset
Horizontal scroll offset. The index of the first column in Table to display when when rendering the view.
- FullRowSelect
True to select the entire row at once. False to select individual cells. Defaults to false
- MaxCellWidth
The maximum number of characters to render in any given column. This prevents one long column from pushing out all the others
- MinCellWidth
The minimum number of characters to render in any given column.
- MultiSelect
True to allow regions to be selected
- MultiSelectedRegions
When MultiSelect is enabled this property contain all rectangles of selected cells. Rectangles describe column/rows selected in Table (not screen coordinates)
- NullSymbol
The text representation that should be rendered for cells with the value Value
- RowOffset
Vertical scroll offset. The index of the first row in Table to display in the first non header line of the control when rendering the view.
- SelectedColumn
The index of Columns in Table that the user has currently selected
- SelectedRow
The index of Rows in Table that the user has currently selected
- SeparatorSymbol
The symbol to add after each cell value and header value to visually separate values (if not using vertical gridlines)
- Style
Contains options for changing how the table is rendered
- Table
The data table to render in the view. Setting this property automatically updates and redraws the control.
Methods
- BuildDemoDataTable(int, int)
Generates a new demo DataTable with the given number of
cols
(min 5) androws
- CellToScreen(int, int)
Returns the screen position (relative to the control client area) that the given cell is rendered or null if it is outside the current scroll area or no table is loaded
- ChangeSelectionByOffset(int, int, bool)
Moves the SelectedRow and SelectedColumn by the provided offsets. Optionally starting a box selection (see MultiSelect)
- ChangeSelectionToEndOfRow(bool)
Moves or extends the selection to the last cell in the current row
- ChangeSelectionToEndOfTable(bool)
Moves or extends the selection to the final cell in the table (nX,nY). If FullRowSelect is enabled then selection instead moves to ( SelectedColumn,nY) i.e. no horizontal scrolling.
- ChangeSelectionToStartOfRow(bool)
Moves or extends the selection to the first cell in the current row
- ChangeSelectionToStartOfTable(bool)
Moves or extends the selection to the first cell in the table (0,0). If FullRowSelect is enabled then selection instead moves to ( SelectedColumn,0) i.e. no horizontal scrolling.
- EnsureSelectedCellIsVisible()
Updates scroll offsets to ensure that the selected cell is visible. Has no effect if Table has not been set.
- EnsureValidScrollOffsets()
Updates ColumnOffset and RowOffset where they are outside the bounds of the table (by adjusting them to the nearest existing cell). Has no effect if Table has not been set.
- EnsureValidSelection()
Updates SelectedColumn, SelectedRow and MultiSelectedRegions where they are outside the bounds of the table (by adjusting them to the nearest existing cell). Has no effect if Table has not been set.
- GetAllSelectedCells()
Returns all cells in any MultiSelectedRegions (if MultiSelect is enabled) and the selected cell
- IsSelected(int, int)
Returns true if the given cell is selected either because it is the active cell or part of a multi cell selection (e.g. FullRowSelect).
Returns false if Visible is false.
- OnCellActivated(CellActivatedEventArgs)
Invokes the CellActivated event
- OnCellToggled(CellToggledEventArgs)
Invokes the CellToggled event
- OnDrawingContent()
Called when the View's content is to be drawn. The default implementation does nothing.
- OnKeyDown(Key)
Called when the user presses a key, allowing subscribers to pre-process the key down event. Called before key bindings are invoked and KeyDownNotHandled is raised. Set Handled to true to stop the key from being processed further.
- OnMouseEvent(MouseEventArgs)
Called when a mouse event occurs within the view's Viewport.
- OnSelectedCellChanged(SelectedCellChangedEventArgs)
Invokes the SelectedCellChanged event
- PageDown(bool)
Moves the selection down by one page
- PageUp(bool)
Moves the selection up by one page
- PositionCursor()
Positions the cursor in the area of the screen in which the start of the active cell is rendered. Calls base implementation if active cell is not visible due to scrolling or table is loaded etc
- RenderCell(Attribute, string, bool)
Override to provide custom multi colouring to cells. Use Driver to with AddStr(string). The driver will already be in the correct place when rendering and you must render the full
render
or the view will not look right. For simpler provision of color use ColorGetter For changing the content that is rendered use RepresentationGetter
- ScreenToCell(Point)
Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- ScreenToCell(Point, out int?)
Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- ScreenToCell(Point, out int?, out int?)
Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- ScreenToCell(int, int)
Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- ScreenToCell(int, int, out int?)
. Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- ScreenToCell(int, int, out int?, out int?)
Returns the column and row of Table that corresponds to a given point on the screen (relative to the control client area). Returns null if the point is in the header, no table is loaded or outside the control bounds.
- SelectAll()
When MultiSelect is on, creates selection over all cells in the table (replacing any old selection regions)
- SetSelection(int, int, bool)
Moves the SelectedRow and SelectedColumn to the given col/row in Table. Optionally starting a box selection (see MultiSelect)
- Update()
Updates the view to reflect changes to Table and to (ColumnOffset / RowOffset) etc
Events
- CellActivated
This event is raised when a cell is activated e.g. by double-clicking or pressing CellActivationKey
- CellToggled
This event is raised when a cell is toggled (see Select
- SelectedCellChanged
This event is raised when the selected cell in the table changes.