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; }

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

Grid

A grid of equal columns.

public static CollectionLayout Grid(
  int columns,
  double spacing = 8)
ParameterSummary
int columnsThe number of columns per row.
(optional) double spacingThe gap between items, in points.

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