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 GridColumnLayoutConstructors
Section titled “Constructors”GridColumnLayout
Section titled “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.
Properties
Section titled “Properties”Choosable
Section titled “Choosable”IEnumerable<GridColumnOption> Choosable { get; }The columns the user may hide (the chooser’s list).
Columns
Section titled “Columns”ObservableCollection<GridColumnOption> Columns { get; }All columns in their default order; GridColumnOption.DisplayIndex holds the user’s order.
VisibleKeys
Section titled “VisibleKeys”IReadOnlyList<string> VisibleKeys { get; }The keys of the shown columns in the user’s order (an export takes these).
Methods
Section titled “Methods”Capture
Section titled “Capture”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.
ResetToDefault
Section titled “ResetToDefault”void ResetToDefault()The default columns, order and widths.
void Save()Keeps the current state through the layout’s save.