Table of Contents

Class DataTable

Namespace
PluginUI
Assembly
PluginUI.dll

Virtualized multi-column table (preset browsers, sample lists, modulation matrices): sortable headers with arrows, resizable columns, striped rows, single or extended selection, keyboard navigation, horizontal and vertical scrolling, and in-place editing of editable columns (double-click or F2).

public class DataTable : Control
Inheritance
DataTable
Inherited Members

Remarks

Call Refresh() after changing the Items list.

Constructors

DataTable()

Creates an empty table.

public DataTable()

Properties

Columns

Columns.

public List<DataColumn> Columns { get; }

Property Value

List<DataColumn>

DefaultSize

Natural size used when no explicit size is given.

protected override Size DefaultSize { get; }

Property Value

Size

EmptyText

Text shown when there are no rows.

public string? EmptyText { get; set; }

Property Value

string

HeaderHeight

Header height (0 = no header).

public float HeaderHeight { get; set; }

Property Value

float

Items

Row items.

public IList? Items { get; set; }

Property Value

IList

MultiSelect

Extended selection (Ctrl / Shift).

public bool MultiSelect { get; set; }

Property Value

bool

RowCount

Number of rows.

public int RowCount { get; }

Property Value

int

RowHeight

Row height.

public float RowHeight { get; set; }

Property Value

float

SelectedItem

First selected item (null = none).

[Browsable(false)]
public object? SelectedItem { get; set; }

Property Value

object

SelectedItems

Selected row items (in view order).

public IEnumerable<object> SelectedItems { get; }

Property Value

IEnumerable<object>

ShowGridLines

Vertical lines between columns.

public bool ShowGridLines { get; set; }

Property Value

bool

SortColumn

Sort column (null = items order).

[Browsable(false)]
public DataColumn? SortColumn { get; }

Property Value

DataColumn

SortDescending

Descending sort.

[Browsable(false)]
public bool SortDescending { get; }

Property Value

bool

Striped

Alternate row shading.

public bool Striped { get; set; }

Property Value

bool

Methods

AddColumn(DataColumn)

Adds a column (fluent).

public DataTable AddColumn(DataColumn column)

Parameters

column DataColumn

Returns

DataTable

BeginEdit(int, int)

Starts editing a cell (view row index, column index) if the column is editable.

public void BeginEdit(int viewRow, int column)

Parameters

viewRow int
column int

LayoutParts(VectorStyle, out Rect, out Rect, out Rect)

Splits the bounds into label (top), widget and value (bottom) areas according to the style. Override to change the arrangement (e.g. label on the left for sliders).

protected override void LayoutParts(VectorStyle style, out Rect label, out Rect widget, out Rect value)

Parameters

style VectorStyle
label Rect
widget Rect
value Rect

OnCaptureLost()

The mouse capture was lost without a button release.

protected override void OnCaptureLost()

OnKeyDown(KeyEventArgs)

Key pressed while focused (bubbles to parents).

protected override void OnKeyDown(KeyEventArgs e)

Parameters

e KeyEventArgs

OnMouseDown(MouseEventArgs)

Mouse button pressed over the element (or captured).

protected override void OnMouseDown(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseLeave()

The mouse left the element.

protected override void OnMouseLeave()

OnMouseMove(MouseEventArgs)

Mouse moved over the element (or captured).

protected override void OnMouseMove(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseUp(MouseEventArgs)

Mouse button released.

protected override void OnMouseUp(MouseEventArgs e)

Parameters

e MouseEventArgs

OnMouseWheel(MouseEventArgs)

Mouse wheel over the element.

protected override void OnMouseWheel(MouseEventArgs e)

Parameters

e MouseEventArgs

OnRenderOverlay(DrawingContext)

Draws the keyboard focus ring.

protected override void OnRenderOverlay(DrawingContext dc)

Parameters

dc DrawingContext

Refresh()

Re-reads the items (after adding, removing or editing rows).

public void Refresh()

RenderVector(DrawingContext, Rect, VectorStyle)

Vector rendering of the widget area.

protected override void RenderVector(DrawingContext dc, Rect widget, VectorStyle style)

Parameters

dc DrawingContext
widget Rect
style VectorStyle

ScrollRowIntoView(int)

Scrolls so that a row (view index) is visible.

public void ScrollRowIntoView(int view)

Parameters

view int

Sort(DataColumn?, bool)

Sorts by a column (null = items order).

public void Sort(DataColumn? column, bool descending = false)

Parameters

column DataColumn
descending bool

Events

RowActivated

Raised on double-click (non-editable cell) or Enter with the row item.

public event Action<DataTable, object>? RowActivated

Event Type

Action<DataTable, object>

SelectionChanged

Raised when the selection changes.

public event Action<DataTable>? SelectionChanged

Event Type

Action<DataTable>

SortChanged

Raised when the sort changes.

public event Action<DataTable>? SortChanged

Event Type

Action<DataTable>