Skip to content
ConsoleMonster
Class

DataGrid

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Implements
IWidget IDisposable
Modifiers
sealed

A retained, embeddable grid. Each instance owns its cursor, viewport, search and marks; the application owns the terminal.

Inheritance

Usage

Explore 41 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 20

Constructors

public DataGrid(string key, Grid? grid = null) #

Creates a grid over an existing listing, or an empty listing.

Parameters

key string required
grid ConsoleMonster.Interactive.Grid? = null optional

Methods

public void ClearSearch() #

Clears prefix search.

public void Dispose() #

Cancels pending cell factories when the control is permanently retired.

public void InvertMarks() #

Inverts marks in the current view.

public void MarkAll() #

Toggles all rows in the current filtered view.

public void MarkPattern(string pattern, int column = 0) #

Marks matching names in the current view. Asterisk matches any sequence and question mark one character.

Parameters

pattern string required
column int = 0 optional
public void Move(int delta) #

Moves the cursor without changing marks.

Parameters

delta int required
public void RefreshRows() #

Refreshes column, sort and filter mappings after changing the listing.

public bool SearchPrefix(string prefix, int column = 0) #

Jumps to the first prefix match without forcing pending cell factories.

Parameters

prefix string required
column int = 0 optional

Returns

bool
public void SetRows(IEnumerable<GridRow> rows) #

Rebinds a listing while retaining the focused identity and surviving marks. Call on the app thread.

Parameters

rows System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.GridRow> required
public void Sort(int column, bool descending = false) #

Sets the sort column; -1 restores listing order.

Parameters

column int required
descending bool = false optional
public void ToggleMark(bool advance = false) #

Toggles the current mark; optionally advances afterwards.

Parameters

advance bool = false optional
public void UnmarkPattern(string pattern, int column = 0) #

Unmarks matching names in the current view.

Parameters

pattern string required
column int = 0 optional

Properties

public Grid Grid { get; } #

The listing and column definitions. Call RefreshRows after changing them.

public int Height { get; set; } #

The maximum natural content height; constrained further by the host viewport.

public bool QuickSearch { get; set; } #

Whether unbound text performs prefix search. Disable when an app registry owns search.

public GridRow? CurrentRow { get; } #

The focused source row, or null for an empty view.

public int Cursor { get; set; } #

The focused visible row index.

public int ScrollRow { get; } #

The first visible row index.

public int VisibleCount { get; } #

The number of rows matching the filter.

public string Filter { get; set; } #

The active substring filter; words must match displayed columns.

public IReadOnlyList<object?> Marks { get; } #

Marked original objects in display sort order, including filtered marks.

public IReadOnlyList<object> MarkedIds { get; } #

Marked stable identities.

public int MarkCount { get; } #

The number of marked identities, including filtered rows.

public IReadOnlyList<object?> Selection { get; } #

The original objects selected by the grid's output mode.

Extension Methods

public static DataGrid CurrentRow(DataGrid dataGrid, Action<GridRow> configure) #

Configures DataGrid.CurrentRow in place: The focused source row, or null for an empty view.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
configure System.Action<ConsoleMonster.Interactive.GridRow> required
Configures the value.

Returns

DataGrid The same instance.
public static DataGrid Cursor(DataGrid dataGrid, int value) #

Sets DataGrid.Cursor: The focused visible row index.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value int required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.Cursor = value;         dataGrid.Cursor(value);
Disabled 2 overloads
public static DataGrid Disabled(DataGrid dataGrid, bool value) #

Sets InputControl.Disabled: Whether this control is excluded from input and focus traversal.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value bool required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.Disabled = value;       dataGrid.Disabled(value);
public static DataGrid Disabled(DataGrid dataGrid) #

Sets InputControl.Disabled to true.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance to configure.

Returns

DataGrid The same instance.
public static DataGrid Filter(DataGrid dataGrid, string value) #

Sets DataGrid.Filter: The active substring filter; words must match displayed columns.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value string required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.Filter = value;         dataGrid.Filter(value);
public static DataGrid Grid(DataGrid dataGrid, Action<Grid> configure) #

Configures DataGrid.Grid in place: The listing and column definitions. Call RefreshRows after changing them.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
configure System.Action<ConsoleMonster.Interactive.Grid> required
Configures the value.

Returns

DataGrid The same instance.
public static DataGrid Height(DataGrid dataGrid, int value) #

Sets DataGrid.Height: The maximum natural content height; constrained further by the host viewport.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value int required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.Height = value;         dataGrid.Height(value);
public static DataGrid Label(DataGrid dataGrid, string? value) #

Sets InputControl.Label: The visible label, or null to use the name.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value string? required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.Label = value;          dataGrid.Label(value);
QuickSearch 2 overloads
public static DataGrid QuickSearch(DataGrid dataGrid, bool value) #

Sets DataGrid.QuickSearch: Whether unbound text performs prefix search. Disable when an app registry owns search.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value bool required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.QuickSearch = value;    dataGrid.QuickSearch(value);
public static DataGrid QuickSearch(DataGrid dataGrid) #

Sets DataGrid.QuickSearch to true.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance to configure.

Returns

DataGrid The same instance.
public static DataGrid TabIndex(DataGrid dataGrid, int value) #

Sets InputControl.TabIndex: Focus order; equal values preserve declaration order.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value int required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property    // C# fluent
dataGrid.TabIndex = value;       dataGrid.TabIndex(value);
public static DataGrid ValidationMessage(DataGrid dataGrid, string? value) #

Sets InputControl.ValidationMessage: The current validation message below the control, or null.

Parameters

dataGrid ConsoleMonster.Interactive.DataGrid required
The instance.
value string? required
The value.

Returns

DataGrid The same instance.

Examples

// C# initializer or property          // C# fluent
dataGrid.ValidationMessage = value;    dataGrid.ValidationMessage(value);