CollectionLayout

The layout of a CollectionView: a list, a grid, or a carousel.
public readonly struct CollectionLayout

Properties

Columns

Columns per row, for a grid.

Type: int

public int Columns { get; }

Grouped

Whether a list uses the native inset-grouped style.

Type: bool

public bool Grouped { get; }

IsFixedGeometry

Whether the collection uses the visible-only fixed geometry layout.

Set by FixedGrid. All other factories return false.

Type: bool

public bool IsFixedGeometry { get; }

ItemAspectRatio

Item width divided by item height for a grid, or null to measure the item template.

The sizing item's explicit height and minimum or maximum height constrain the derived row height.

Type: double?

public double? ItemAspectRatio { get; }

ItemWidth

Item width for a carousel, in points.

Type: double

public double ItemWidth { get; }

Kind

Which arrangement this is.

Type: CollectionLayoutKind

public CollectionLayoutKind Kind { get; }

Snap

How a carousel settles when the drag ends.

Type: CarouselSnap

public CarouselSnap Snap { get; }

Spacing

Gap between items, in points.

Type: double

public double Spacing { get; }

Methods

A horizontally scrolling row of fixed-width items, optionally snapping as it settles.

public static CollectionLayout Carousel(
  double itemWidth,
  double spacing = 8,
  CarouselSnap snap = None)
ParameterSummary
double itemWidthThe width of each item, in points.
(optional) double spacingThe gap between items, in points.
(optional) CarouselSnap snapHow scrolling settles when the drag ends.

Returns

FixedGrid

A grid with fixed geometry that reads only the visible sections.

SkeleKit measures the item template, the section header template, and the section footer template one time at each geometry build. All sections use the measured sizes. Use this layout with a virtualized source for a large or computed list. Use Grid for self-sizing items.

public static CollectionLayout FixedGrid(
  int columns,
  double spacing = 8,
  double? itemAspectRatio = null)
ParameterSummary
int columnsThe number of columns per row.
(optional) double spacingThe gap between items, in points.
(optional) double? itemAspectRatioThe item width divided by its height, or null to measure the first item template.

Returns

Grid

A grid of equal columns.

public static CollectionLayout Grid(
  int columns,
  double spacing = 8,
  double? itemAspectRatio = null)
ParameterSummary
int columnsThe number of columns per row.
(optional) double spacingThe gap between items, in points.
(optional) double? itemAspectRatioThe item width divided by its height, or null to measure the item template.

Returns

List

A list of full-width rows; grouped uses the native inset-grouped style.

public static CollectionLayout List(
  bool grouped = false)
ParameterSummary
(optional) bool groupedWhether to use the native inset-grouped style.

Returns