Form

GPALListView

Everything on Settings Every Control Takes applies here too. GPAL.ListView builds one. WithColumns names the columns and WithView picks the mode, Details, List, LargeIcon, SmallIcon or Tile, where Details is the one that shows columns. WithColumnWidth takes pixel widths in column order, or shares as doubles, in which case the columns reflow as the form resizes. WithColumnWeight gives one column a share. WithSortable lets a click on a header sort the rows. WithCheckBoxes puts a checkbox on every row and WithFullRowSelect makes a click anywhere in a row select it. WithMultiSelect allows more than one row selected. AddItem adds a row, one value per column. DisableItem greys a row and EnableItem restores it. CheckedItems and SelectedItems each answer a read-only list of bool, one per row, so ticking and selection are read separately. ItemChecked and SelectedIndexChanged are the events to hang a handler on. GPAL.ListViewFor(columns) is the shorthand.

Examples

GPAL Fluent: High-level fluent C# API

//Shares and pixel widths are two overloads of the same call: doubles reflow with the form, ints hold their size and the last column takes whatever the others leave. CheckedItems and SelectedItems are parallel to the rows, so index 2 in either is the third row.

GPALListView files = (GPALListView)GPAL.ListView

.WithColumns("File", "Size", "Status")

.WithColumnWidth(0.5, 0.2, 0.3)

.WithCheckBoxes()

.WithFullRowSelect(true)

.WithSortable()

.WithName("files");


files.AddItem("File1.txt", "2.5 MB", "Done");

files.AddItem("File2.pdf", "1.8 MB", "Pending");

files.AddItem("File3.lock", "0 KB", "Locked by another run");


// the row stays visible so it can say why it is out

files.DisableItem(2);


// which rows the user ticked, and which row is highlighted

IReadOnlyList<bool> ticked = files.CheckedItems;

IReadOnlyList<bool> selected = files.SelectedItems;

💬 Ask GPAL