Table of Contents

Class GroupGridEngine

Namespace
Avalonia.Controls
Assembly
Tripous.Avalonia.Controls.dll

Represents the non-visual state, data adapter, columns, and row projection of a group grid.

public class GroupGridEngine
Inheritance
GroupGridEngine
Inherited Members
Extension Methods

Constructors

GroupGridEngine()

Initializes a new instance of the GroupGridEngine class.

public GroupGridEngine()

Properties

BodyHeight

Gets the rendered body height used for hit testing.

public double BodyHeight { get; }

Property Value

double

Columns

Gets the grid columns.

public ObservableCollection<GroupGridColumn> Columns { get; }

Property Value

ObservableCollection<GroupGridColumn>

CurrentCell

Gets the current cell.

public GroupGridCell CurrentCell { get; }

Property Value

GroupGridCell

CurrentColumn

Gets the current column, or null when there is no current cell.

public GroupGridColumn CurrentColumn { get; }

Property Value

GroupGridColumn

CurrentRowIndex

Gets the current row index, or -1 when there is no current cell.

public int CurrentRowIndex { get; }

Property Value

int

DataAdapter

Gets or sets the data adapter.

public IGroupGridDataAdapter DataAdapter { get; set; }

Property Value

IGroupGridDataAdapter

EditingCell

Gets the editing cell.

public GroupGridCell EditingCell { get; }

Property Value

GroupGridCell

FilterCount

Gets the number of active column filters.

public int FilterCount { get; }

Property Value

int

GroupColumnCount

Gets the number of grouped columns.

public int GroupColumnCount { get; }

Property Value

int

GroupColumns

Gets the grouped columns in grouping order.

public IReadOnlyList<GroupGridColumn> GroupColumns { get; }

Property Value

IReadOnlyList<GroupGridColumn>

HasCurrentCell

Gets a value indicating whether the grid has a current cell.

public bool HasCurrentCell { get; }

Property Value

bool

HasFilters

Gets a value indicating whether any column filter is active.

public bool HasFilters { get; }

Property Value

bool

HasSelectedCell

Gets a value indicating whether the grid has a selected cell.

public bool HasSelectedCell { get; }

Property Value

bool

IsEditing

Gets a value indicating whether the grid is editing a cell.

public bool IsEditing { get; }

Property Value

bool

IsReadOnly

Gets or sets a value indicating whether editing is disabled for the whole grid.

public bool IsReadOnly { get; set; }

Property Value

bool

LayoutMetrics

Gets the layout metrics used by non-visual hit testing.

public GroupGridLayoutMetrics LayoutMetrics { get; }

Property Value

GroupGridLayoutMetrics

RowCount

Gets the number of adapter rows.

public int RowCount { get; }

Property Value

int

SelectedCell

Gets the selected cell.

public GroupGridCell SelectedCell { get; }

Property Value

GroupGridCell

SelectedColumn

Gets the selected column, or null when there is no selected cell.

public GroupGridColumn SelectedColumn { get; }

Property Value

GroupGridColumn

SelectedRowIndex

Gets the selected row index, or -1 when there is no selected cell.

public int SelectedRowIndex { get; }

Property Value

int

SortColumn

Gets the sorted column, or null when sorting is not active.

public GroupGridColumn SortColumn { get; }

Property Value

GroupGridColumn

SortDirection

Gets the active sort direction.

public GroupGridSortDirection SortDirection { get; }

Property Value

GroupGridSortDirection

Viewport

Gets the viewport window into the logical visible-node list.

public GroupGridViewport Viewport { get; }

Property Value

GroupGridViewport

VisibleNodeCount

Gets the number of visible projected nodes.

public int VisibleNodeCount { get; }

Property Value

int

Methods

BeginEdit()

Begins editing the current cell.

public bool BeginEdit()

Returns

bool

True if editing started; otherwise, false.

BeginEdit(GroupGridCell)

Begins editing a cell.

public bool BeginEdit(GroupGridCell Cell)

Parameters

Cell GroupGridCell

The cell to edit.

Returns

bool

True if editing started; otherwise, false.

BeginEdit(int, GroupGridColumn)

Begins editing a cell by row index and column.

public bool BeginEdit(int RowIndex, GroupGridColumn Column)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Returns

bool

True if editing started; otherwise, false.

CanDeleteCurrentRow()

Returns true when the current row can be deleted.

public bool CanDeleteCurrentRow()

Returns

bool

True when the current row can be deleted; otherwise, false.

CanInsertRow()

Returns true when a new row can be inserted after the current row.

public bool CanInsertRow()

Returns

bool

True when a row can be inserted; otherwise, false.

CanSetValue(int, GroupGridColumn)

Returns true when a value can be set at a specified adapter row index and column.

public bool CanSetValue(int RowIndex, GroupGridColumn Column)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Returns

bool

True when the cell value can be set; otherwise, false.

CancelEdit()

Cancels the current edit.

public bool CancelEdit()

Returns

bool

True if an edit was canceled; otherwise, false.

ClearColumnFilter(GroupGridColumn)

Clears the text filter for a column.

public bool ClearColumnFilter(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

bool

True if the filter changed; otherwise, false.

ClearCurrentCell()

Clears the current cell.

public void ClearCurrentCell()

ClearFilters()

Clears all column filters.

public bool ClearFilters()

Returns

bool

True if any filter was cleared; otherwise, false.

ClearSelection()

Clears the selected cell.

public void ClearSelection()

ClearSort()

Clears the active column sorting.

public bool ClearSort()

Returns

bool

True if sorting changed; otherwise, false.

CommitEdit(object)

Commits the edited value.

public bool CommitEdit(object Value)

Parameters

Value object

The editor value.

Returns

bool

True if the edit was committed; otherwise, false.

DeleteCurrentRow()

Deletes the current row.

public bool DeleteCurrentRow()

Returns

bool

True if a row was deleted; otherwise, false.

GetColumnFilter(GroupGridColumn)

Returns the text filter applied to a column.

public string GetColumnFilter(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

string

The filter text, or an empty string when no filter is applied.

GetDisplayText(int, GroupGridColumn)

Returns the display text for a visible body row and value column.

public string GetDisplayText(int VisibleNodeIndex, GroupGridColumn Column)

Parameters

VisibleNodeIndex int

The visible-node index.

Column GroupGridColumn

The grid column.

Returns

string

The display text.

GetGroupHeaderText(int)

Returns the display text for a group header row.

public string GetGroupHeaderText(int VisibleNodeIndex)

Parameters

VisibleNodeIndex int

The visible-node index.

Returns

string

The group header display text.

GetGroupSummary(int, GroupGridColumn)

Returns a group summary value by visible-node index and column.

public GroupGridSummaryValue GetGroupSummary(int VisibleNodeIndex, GroupGridColumn Column)

Parameters

VisibleNodeIndex int

The visible-node index.

Column GroupGridColumn

The grid column.

Returns

GroupGridSummaryValue

The summary value.

GetTotalSummary(GroupGridColumn)

Returns a total summary value by column.

public GroupGridSummaryValue GetTotalSummary(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

GroupGridSummaryValue

The summary value.

GetTotalSummaryText(GroupGridColumn)

Returns the display text for a footer summary cell.

public string GetTotalSummaryText(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

string

The footer summary display text.

GetValue(int, GroupGridColumn)

Returns the cell value at a specified adapter row index and column.

public object GetValue(int RowIndex, GroupGridColumn Column)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Returns

object

The cell value.

GetVisibleColumns()

Returns the visible columns in display order.

public IReadOnlyList<GroupGridColumn> GetVisibleColumns()

Returns

IReadOnlyList<GroupGridColumn>

The visible columns.

GetVisibleRow(int)

Returns the source row at a visible node index.

public object GetVisibleRow(int VisibleNodeIndex)

Parameters

VisibleNodeIndex int

The visible node index.

Returns

object

The source row, or null when the visible node is not a data row.

GetVisibleRowInfo(int)

Returns information about a visible row.

public GroupGridRowInfo GetVisibleRowInfo(int VisibleNodeIndex)

Parameters

VisibleNodeIndex int

The visible-node index.

Returns

GroupGridRowInfo

The visible row information.

GetVisibleValueColumns()

Returns the visible value columns in display order.

public IReadOnlyList<GroupGridColumn> GetVisibleValueColumns()

Returns

IReadOnlyList<GroupGridColumn>

The visible value columns.

GroupColumn(GroupGridColumn, int)

Adds a column to the grouping list.

public bool GroupColumn(GroupGridColumn Column, int GroupIndex = -1)

Parameters

Column GroupGridColumn

The grid column.

GroupIndex int

The group index, or -1 to append.

Returns

bool

True if the column was grouped; otherwise, false.

HitTest(double, double)

Returns hit-test information for a point in local grid coordinates.

public GroupGridHitTestResult HitTest(double X, double Y)

Parameters

X double

The local x-coordinate.

Y double

The local y-coordinate.

Returns

GroupGridHitTestResult

The hit-test result.

IndexOfVisibleColumn(GroupGridColumn)

Returns the visible column index of a specified column.

public int IndexOfVisibleColumn(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

int

The visible column index, or -1 if not found.

IndexOfVisibleRow(int)

Returns the visible-node index of a specified adapter row index.

public int IndexOfVisibleRow(int RowIndex)

Parameters

RowIndex int

The adapter row index.

Returns

int

The visible-node index, or -1 if not found.

InsertRow()

Inserts a new row after the current row.

public bool InsertRow()

Returns

bool

True if a row was inserted; otherwise, false.

IsGroupedColumn(GroupGridColumn)

Returns true when a column is grouped.

public bool IsGroupedColumn(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

bool

True if the column is grouped; otherwise, false.

IsSelectedCell(GroupGridCell)

Returns true when a cell is selected.

public bool IsSelectedCell(GroupGridCell Cell)

Parameters

Cell GroupGridCell

The cell to check.

Returns

bool

True if the cell is selected; otherwise, false.

IsSelectedRow(int)

Returns true when an adapter row is selected.

public bool IsSelectedRow(int RowIndex)

Parameters

RowIndex int

The adapter row index.

Returns

bool

True if the row is selected; otherwise, false.

MoveColumn(GroupGridColumn, int)

Moves a column to a new display index in the column collection.

public bool MoveColumn(GroupGridColumn Column, int ColumnIndex)

Parameters

Column GroupGridColumn

The grid column.

ColumnIndex int

The new column index.

Returns

bool

True if the column moved; otherwise, false.

MoveCurrentCell(int, int)

Moves the current cell by visible row and column deltas.

public bool MoveCurrentCell(int RowDelta, int ColumnDelta)

Parameters

RowDelta int

The visible row delta.

ColumnDelta int

The visible column delta.

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentColumn(int)

Moves the current cell horizontally by a visible column delta.

public bool MoveCurrentColumn(int ColumnDelta)

Parameters

ColumnDelta int

The visible column delta.

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentRow(int)

Moves the current cell vertically by a visible data-row delta.

public bool MoveCurrentRow(int RowDelta)

Parameters

RowDelta int

The visible row delta.

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentToFirstColumn()

Moves the current cell to the first visible value column in the current row.

public bool MoveCurrentToFirstColumn()

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentToFirstRow()

Moves the current cell to the first visible data row.

public bool MoveCurrentToFirstRow()

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentToLastColumn()

Moves the current cell to the last visible value column in the current row.

public bool MoveCurrentToLastColumn()

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentToLastRow()

Moves the current cell to the last visible data row.

public bool MoveCurrentToLastRow()

Returns

bool

True if the current cell moved; otherwise, false.

MoveCurrentToNextEditableCell(bool)

Moves the current cell to the next editable visible cell.

public bool MoveCurrentToNextEditableCell(bool Forward)

Parameters

Forward bool

True to move forward; false to move backward.

Returns

bool

True if the current cell moved; otherwise, false.

MoveGroupedColumn(GroupGridColumn, int)

Moves a grouped column to a new group index.

public bool MoveGroupedColumn(GroupGridColumn Column, int GroupIndex)

Parameters

Column GroupGridColumn

The grouped column.

GroupIndex int

The new group index.

Returns

bool

True if the column moved; otherwise, false.

RebuildProjection()

Rebuilds the root-node and visible-node projection from the current data adapter.

public void RebuildProjection()

RequestEdit()

Raises the edit requested event.

public void RequestEdit()

SelectCurrentCell()

Selects the current cell.

public bool SelectCurrentCell()

Returns

bool

True if the selected cell changed; otherwise, false.

SetColumnFilter(GroupGridColumn, string)

Sets the contains-text filter for a column.

public bool SetColumnFilter(GroupGridColumn Column, string FilterText)

Parameters

Column GroupGridColumn

The grid column.

FilterText string

The filter text.

Returns

bool

True if the filter changed; otherwise, false.

SetColumnVisible(GroupGridColumn, bool)

Shows or hides a column.

public bool SetColumnVisible(GroupGridColumn Column, bool IsVisible)

Parameters

Column GroupGridColumn

The grid column.

IsVisible bool

True to show the column; false to hide it.

Returns

bool

True if the column visibility changed; otherwise, false.

SetCurrentCell(GroupGridCell)

Sets the current cell.

public bool SetCurrentCell(GroupGridCell Cell)

Parameters

Cell GroupGridCell

The current cell.

Returns

bool

True if the current cell changed; otherwise, false.

SetCurrentCell(int, GroupGridColumn)

Sets the current cell by row index and column.

public bool SetCurrentCell(int RowIndex, GroupGridColumn Column)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Returns

bool

True if the current cell changed; otherwise, false.

SetGroupExpanded(int, bool)

Sets the expanded state of a group node by visible-node index.

public bool SetGroupExpanded(int VisibleNodeIndex, bool IsExpanded)

Parameters

VisibleNodeIndex int

The visible-node index.

IsExpanded bool

True to expand; false to collapse.

Returns

bool

True if the group state changed; otherwise, false.

SetSelectedCell(GroupGridCell)

Sets the selected cell.

public bool SetSelectedCell(GroupGridCell Cell)

Parameters

Cell GroupGridCell

The selected cell.

Returns

bool

True if the selected cell changed; otherwise, false.

SetSelectedCell(int, GroupGridColumn)

Sets the selected cell by row index and column.

public bool SetSelectedCell(int RowIndex, GroupGridColumn Column)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Returns

bool

True if the selected cell changed; otherwise, false.

SetValue(int, GroupGridColumn, object)

Sets the cell value at a specified adapter row index and column.

public void SetValue(int RowIndex, GroupGridColumn Column, object Value)

Parameters

RowIndex int

The adapter row index.

Column GroupGridColumn

The grid column.

Value object

The value to set.

SetViewport(GroupGridViewport)

Sets the viewport window into the logical visible-node list.

public bool SetViewport(GroupGridViewport Viewport)

Parameters

Viewport GroupGridViewport

The viewport.

Returns

bool

True if the viewport changed; otherwise, false.

SetViewport(GroupGridViewport, double)

Sets the viewport window and the rendered body height.

public bool SetViewport(GroupGridViewport Viewport, double BodyHeight)

Parameters

Viewport GroupGridViewport

The viewport.

BodyHeight double

The rendered body height.

Returns

bool

True if the viewport or body height changed; otherwise, false.

ToggleGroupExpanded(int)

Toggles the expanded state of a group node by visible-node index.

public bool ToggleGroupExpanded(int VisibleNodeIndex)

Parameters

VisibleNodeIndex int

The visible-node index.

Returns

bool

True if the group state changed; otherwise, false.

ToggleSort(GroupGridColumn)

Toggles sorting for a column using the None, Ascending, Descending cycle.

public bool ToggleSort(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The column to sort by.

Returns

bool

True if sorting changed; otherwise, false.

UngroupColumn(GroupGridColumn)

Removes a column from the grouping list.

public bool UngroupColumn(GroupGridColumn Column)

Parameters

Column GroupGridColumn

The grid column.

Returns

bool

True if the column was ungrouped; otherwise, false.

Events

BeginningEdit

Occurs before cell editing begins.

public event EventHandler<GroupGridCellEditEventArgs> BeginningEdit

Event Type

EventHandler<GroupGridCellEditEventArgs>

CellValidating

Occurs before an edited value is committed.

public event EventHandler<GroupGridCellEditEventArgs> CellValidating

Event Type

EventHandler<GroupGridCellEditEventArgs>

CellValueCommitted

Occurs after the value is written to the adapter.

public event EventHandler<GroupGridCellEditEventArgs> CellValueCommitted

Event Type

EventHandler<GroupGridCellEditEventArgs>

CellValueCommitting

Occurs after validation and before the value is written to the adapter.

public event EventHandler<GroupGridCellEditEventArgs> CellValueCommitting

Event Type

EventHandler<GroupGridCellEditEventArgs>

ColumnsChanged

Occurs when the columns collection changes.

public event EventHandler ColumnsChanged

Event Type

EventHandler

CurrentCellChanged

Occurs when the current cell changes.

public event EventHandler CurrentCellChanged

Event Type

EventHandler

CurrentRowChanged

Occurs when the current row changes.

public event EventHandler CurrentRowChanged

Event Type

EventHandler

DataAdapterChanged

Occurs when the data adapter changes.

public event EventHandler DataAdapterChanged

Event Type

EventHandler

DataChanged

Occurs when the adapter reports a data change.

public event EventHandler<GroupGridDataChangedEventArgs> DataChanged

Event Type

EventHandler<GroupGridDataChangedEventArgs>

DeletingRow

Occurs before a row is deleted.

public event EventHandler<GroupGridRowOperationEventArgs> DeletingRow

Event Type

EventHandler<GroupGridRowOperationEventArgs>

EditCanceled

Occurs when editing is canceled.

public event EventHandler<GroupGridCellEditEventArgs> EditCanceled

Event Type

EventHandler<GroupGridCellEditEventArgs>

EditRequested

Occurs when edit is requested by a toolbar command.

public event EventHandler EditRequested

Event Type

EventHandler

EditingCellChanged

Occurs when the editing cell changes.

public event EventHandler EditingCellChanged

Event Type

EventHandler

FiltersChanged

Occurs when column filters change.

public event EventHandler FiltersChanged

Event Type

EventHandler

GroupColumnsChanged

Occurs when the grouped columns list changes.

public event EventHandler GroupColumnsChanged

Event Type

EventHandler

InsertingRow

Occurs before a row is inserted.

public event EventHandler<GroupGridRowOperationEventArgs> InsertingRow

Event Type

EventHandler<GroupGridRowOperationEventArgs>

RowDeleted

Occurs after a row is deleted.

public event EventHandler<GroupGridRowOperationEventArgs> RowDeleted

Event Type

EventHandler<GroupGridRowOperationEventArgs>

RowInserted

Occurs after a row is inserted.

public event EventHandler<GroupGridRowOperationEventArgs> RowInserted

Event Type

EventHandler<GroupGridRowOperationEventArgs>

SelectionChanged

Occurs when the selected cell changes.

public event EventHandler SelectionChanged

Event Type

EventHandler

SortingChanged

Occurs when column sorting changes.

public event EventHandler SortingChanged

Event Type

EventHandler

SummariesChanged

Occurs when summary values change.

public event EventHandler SummariesChanged

Event Type

EventHandler

ViewportChanged

Occurs when the viewport window into the logical visible-node list changes.

public event EventHandler ViewportChanged

Event Type

EventHandler

VisibleNodesChanged

Occurs when the logical flat list of visible nodes changes. This is the full row projection after grouping or expansion rules, not the viewport subset currently rendered on screen.

public event EventHandler VisibleNodesChanged

Event Type

EventHandler