Skip to content
realonepiecefreak edited this page Oct 6, 2024 · 5 revisions

List

A scrollable list of components, which can optionally be selected.

list_vertical list_horizontal

Usage

To create a list of labels:

var list = new List<Label>
{
    Items =
    {
        new Label("Label 1"),
        new Label("Label 2")
    }
}

Properties

  • Items: The items to render
  • SelectedItem: The currently selected item, or null; Does not invoke the SelectedItemChanged event
  • Alignment: If the items are displayed vertically and horizontally
  • Size: The size of the list
  • ItemSpacing: The spacing between the items
  • Padding: The padding between the list border and items
  • ScrollToLastItem: If the list should scroll to the last item in the list after adding a new item
  • IsSelectable: If items can be selected

Events

  • SelectedItemChanged: For when the SelectedItem was changed

DataTable

A table of data columns and rows, for a uniform view on a list of entries.

datatable

Usage

Create a data table with column headers:

var table = new DataTable<int>
{
    // Defines the columns, their headers, and how to get the value from each data entry
    Columns =
    {
        new DataTableColumn<int>(i => $"{i}", "Value")
    },
    // Adds the actual data entries
    Rows =
    {
        new DataTableRow<int>(0)
    }
};

Properties

  • Size: the size of the table
  • ContextMenu: A ContextMenu, when a data entry is right-clicked
  • Columns: The column header and value getter definitions
  • Rows: The data entries in the table
  • SelectedRows: Gets the currently selected data entries
  • IsResizable: If the column headers are resizable
  • IsSelectable: If data entries can be selected
  • ShowHeaders: If the column headers should be rendered
  • CanSelectMultiple: If multiple data entries can be selected at the same time; Hold Ctrl while left-clicking entries

Events

  • SelectedRowsChanged: For when the selected data entries were changed
  • DoubleClicked: For when a data entry was double clicked
Clone this wiki locally