Skip to content

GridColumnLayout

Class in Oadm.Sdk.Client.Controls · Oadm.Sdk.Client.dll

The columns of a grid the user chooses (SDK 0.17.0): which show, their order and widths, kept per user through load and save (the device grid: the client’s settings; a plugin page: Get/SetLocalSetting). Bind a DataGrid with GridColumnBinder.Attach (columns matched by their Tag) and offer GridColumnLayout.Choosable with a ColumnChooserButton. View model side, testable without Avalonia.

public sealed class GridColumnLayout
GridColumnLayout(IReadOnlyList<GridColumnDefinition> columns, IReadOnlyList<GridColumnState> load, Action<IReadOnlyList<GridColumnState>> save)

Parameters

  • columns: The columns in their default order.
  • load: The saved state (empty: the defaults); unknown keys are ignored, new columns get their default.
  • save: Keeps the state after every change.
IEnumerable<GridColumnOption> Choosable { get; }

The columns the user may hide (the chooser’s list).

ObservableCollection<GridColumnOption> Columns { get; }

All columns in their default order; GridColumnOption.DisplayIndex holds the user’s order.

IReadOnlyList<string> VisibleKeys { get; }

The keys of the shown columns in the user’s order (an export takes these).

void Capture(IEnumerable<(string Key, int DisplayIndex, double Width)> state)

Called by the view after the user reordered or resized columns.

GridColumnOption? Find(string key)

The column with key; null when there is none.

void ResetToDefault()

The default columns, order and widths.

void Save()

Keeps the current state through the layout’s save.